Friday, February 24, 2012

Custom Code accessing Dataset

Hello

my problem is this ...i pass a parameter from an asp page to open a report which works fine, however the display name for the text box in the header of the report should be the description of the parameter not the parameter id

i would like to create a function in the custom code that passes the parameter id and returns the parameter description as the possible description values are dynamic and there are over 400 hardcoding the code is not an option

thanks in advance for any advice

I'm not clear on what you are reffering to as "parameter description"? A report parameter will have three values accessible through either custom code or through a report expression: Value, Label, and IsMultiValue. If the "parameter description" is something defeined outside of the report you can access it in cusom code just as you could in any other .NET code.

Thanks, Jon

|||

You mean that you have a parameter which includes description as text and ID as value?

You should be able to query this in the way described here:
http://msdn2.microsoft.com/en-us/library/ms157274.aspx

The Parameters collection contains the report parameter objects within the report. Parameters can be passed to queries, used in filters, or used in other functions that alter the report appearance and content based on the parameter. When you define query parameters, they are automatically added to the report parameter collection. The following table describes the properties defined on a Parameter: Count, IsMultiValue, Value and Label.

Property

Description

Count

An integer that indicates the number of parameters in the collection.

IsMultiValue

A Boolean that identifies this parameter as having a set of values.

Value

The value for the parameter. For a multivalued parameter, Value returns an array of objects.

Label

A user-friendly label for the parameter. If no label is specified, the value of the Label property equals the Value property. If more than one Label is associated with the same Value, the first matching Label is used. For a multivalued parameter, Label returns an array of objects.

Parameters can be accessed through either the property syntax or the collection syntax. The following expression shows how to access every member of the Parameters collection and, when placed in a text box in a report item, displays the contents of the parameter ProductSubCategory.

So a proper expression for e.g. a parameter called Product would be:
Parameters!Product.Label

cheers,
Markus

No comments:

Post a Comment