Excel

Saturday, July 9, 2011

SSRS : Displaying Parameter values as a Label in the report

We can just show the Parameter value in the text box by writing simple expression as
=Parameters!ParamName.value
But If the Parameter is a Multi value parameter, we have to write Join expression to display multiple selected values. Ex:  
                    = Join(Parameters!ParamName.Value, “,”)
 This will give you comma separated list of parameter values
In this method, if the number selected values are more, the text box will grow up the report might not look nice. If we want to show “ALL”, or <Some message> when ‘Select All’ is selected in the report parameter, we can use the following expression(Assuming that the values for the parmaters are supplied from the data set “DataSet_ParamName”)
=IIF(Sum(Fields!ID.Value, “DataSet_ParamName”)=Parameters!ParamName.Count, ”Al””,Join(Parameters!ParamName.Value, “,”))
We can also change the same expression to display some message when the selected Parameters count is greater than some values.
=IIF(Parameters!ParamName.Count >=2, ”Selected More than 2”,Join(Parameters!ParamName.Value, “,”))
If the selected parameter count is greater than 2 then it will show the message as as “Selected More than 2”.

No comments:

Post a Comment