Showing posts with label properties. Show all posts
Showing posts with label properties. Show all posts

Thursday, March 22, 2012

Calling non-static methods in dll

Hello,

I have a dll which is developed in C#. I have made a reference to it from Reporting Services under Report Properties.

My problem is, that the methods in this dll are not static. Therefore under the Classes in Report Properties I have written the class-name and the instance-names of the instances that I need to use from this class (as I understand it, this is what you have to do if using non-static methods). In a text-box, I call one of the instances in the class, but I get this error:

[rsInvalidName] 'MyMethod()' is not a valid code class name. Names of objects must be CLS-compliant identifiers.

What exactly have I done wrong here?

Thanks
/Peter

Hi Peter,

In the code window, you'll need something similar to:

Dim InstanceName As Instance

Then you should be able to set the value of your textbox to: =Code.InstanceName.FunctionName(Params).

Keep in mind that all of these lines are case-sensitive.

If this isn't working, could you post a snippet of what you're doing, so we can take a further look at it?

-Jessica

|||

Hi Jessica. Thanks for your reply :-)

I have a class (let's call it myClass) and a method in that class (let's call it myMethod).

The Class is declared as: public class myClass and the method is declared as: public string myMethod(params).

The resulting dll (let's call it myDLL) is added to the references-tab of Report Properties. In the Code-tab I have written (I have tried many combinations): Public Dim class1 As myDLL.myClass. I have used the Public-keyword because it complained that class1 was declared private. In the textbox-controller I have written: =code.class1.myMethod(params). But it doesn't work. The text-box writes: #Error and I get the warning:

Build complete -- 0 errors, 0 warnings

[rsRuntimeErrorInExpression] The Value expression for the textbox 'textbox5' contains an error: Object reference not set to an instance of an object.

So it appears that class1 is not an instance of myDLL.myClass. I have tried many combinations and also with and without adding "Class name" and "Instance name" in the References tab of Report Properties.

Any suggestions ?

Thanks

/Peter

|||

Hi again,

I works now. I removed the code in the Code-tab and added the class to the References-tab under "Class name" and "Instance name". I then wrote: =code.InstanceName.MethodName(param) in the text-box and it works. I didn't have the "code" part to begin with, so that was my problem.

Thanks for your input. I appreciate it :-)

/Peter

Friday, February 10, 2012

Calculated Member using CurrentMember.Properties("XX") does not work for ALL Level on

IIF (

[HAP5All_Board].CurrentMember.Properties("Dept") = "PH",

(

[BoardIncAcct2].&[61510000] -- General Services

+

[BoardIncAcct2].&[61520000] -- Accounting & Financem Services

+

[BoardIncAcct2].&[61530000] -- Information Technology Services

+

[BoardIncAcct2].&[61540000] -- Purchaseing Services

+

[BoardIncAcct2].&[61550000] -- Executive Services

+

[BoardIncAcct2].&[61560000] -- Human Resources Services

+

[BoardIncAcct2].&[61570000] -- Public Affairs Services

+

[BoardIncAcct2].&[61580000] -- Training Services

)

,

0

) -- IIF Section to filter in only PH

This is in the definition of a calculated member. It works fine for all members except for the "ALL level" on the dimension (Parent-Child dimension). Because the "All Level" is not actually a member/record in the table but defined on the dimension, it does not have Properties for that particular "member", so AS errors out when trying to focus on top ALL Level. What should we do to use such definition on ALL Level?

Maybe you could check for the [All] member first, like:

IIF (

[HAP5All_Board].CurrentMember is [HAP5All_Board].[All],

0,

IIF (

[HAP5All_Board].CurrentMember.Properties("Dept") = "PH",

(

[BoardIncAcct2].&[61510000] -- General Services

+

[BoardIncAcct2].&[61520000] -- Accounting & Financem Services

+

[BoardIncAcct2].&[61530000] -- Information Technology Services

+

[BoardIncAcct2].&[61540000] -- Purchaseing Services

+

[BoardIncAcct2].&[61550000] -- Executive Services

+

[BoardIncAcct2].&[61560000] -- Human Resources Services

+

[BoardIncAcct2].&[61570000] -- Public Affairs Services

+

[BoardIncAcct2].&[61580000] -- Training Services

)

,

0

) -- IIF Section to filter in only PH

)

|||

Thanks, Deepak!

That works syntactically. OLAP took it. However, I am wondering that ALL level is taking the aggregate sumation of all children, would that (IF ALL THEN 0) rules out children that actually is PH in Properties. Or in other words, I need to have PH and all others roll up into ALL with PH children having those accounts incluced. Would (IFF ALL THEN 0) prevent PH children to be correctly rolled up? Am I making sense?

Thanks again!

Julius

|||

Hi Julius,

Could you illustrate your exact scenario with some examples - I have only a vague idea of what you want, since 2 different dimensions seem to be involved?