Monday, March 19, 2012

Displaying selected parameters in a report

Hi,

In the report I'm working on, I want to display a list of the parameters selected by the user, as in:

Selected Cars:
Toyota Camry
Ford Taurus
Chevy Corvette
Saturn Ion

Note that these are selected items from a multi-value parameter. How can I go about doing this with Reporting Services 2005? In ASP.NET, I'd just use the parameter array as the datasource for a repeater/datagrid/gridview. Could I do something similar with SSRS? I'd really like to use the format specified above, whether or not it is in a table; I really don't want to do the following:

Selected Cars: Toyota Camry, Ford Taurus, Chevy Corvette, Saturn Ion.

Thanks,
MarkOkay, I figured out how to do this using the following expression:

=Join(Parameters!parameter_name.Value, vbNewLine)

My question now is, can I use the parameter label instead of the value? Or, alternatively, is there a way to trim a character off the end of the value when displaying it? In my stored proc, I had to append a delimiter (a | in my case) to the value, but I don't want this to appear in the report.

Right now, it looks like:

Selected Cars:
Toyota Camry|
Ford Taurus|
Chevy Corvette|
Saturn Ion|

Thanks,
Mark|||

To show the Parameter label, use the .Label property instead of .Value:

Parameters!parameter_name.Label

For multi-value parameters, the Label property (like the Value property) will return an array of values so you will have to Join() them.

|||I tried that earlier and got an error, but I must have done something else wrong because I just tried it again and it works. Thanks!

No comments:

Post a Comment