How do I write an expression in SSRS that shows only selected parameters when the report is run or previewed? Thank you.
0
votes
i can't understand you could you explain better your question
– Ryuzaki
I want that when a report is run, only selected parameters are displayed. For example, I have up to 6 parameters in a report and all allow null values. A user can input any parameter of choice. Now assuming that a user inputted or selected only parameters, I want to write an expression that allows them to see only the list or names of the selected parameters in the Header or Footer body of the report rather than seeing all parameters returned.
– UpwardD
2 Answers
0
votes
0
votes
In your expression you can use: "Parameters!.Value" to reference the value of a parameter; so to put that value into, say, a basic text box control, you can simply set the expression to:
=Parameters!<parameter name>.Value
It gets trickier with multivalued parameters. To reference the first value in the collection, you'd write:
=Parameters!<parameter name>.Value(0)
And you can replace 0 with the position of any value in the array that you'd prefer. Of course, obviously it's impractical to write:
=Parameters!<parameter name>.Value(0)
=Parameters!<parameter name>.Value(1)
=Parameters!<parameter name>.Value(2)
...
=Parameters!<parameter name>.Value(9999)
For every potential parameter you have. Instead, you can use the "JOIN" function, specifying the delimiter you'd like, and it will return all of your parameters wrapped up into a single string:
=Join(Parameters!<parameter name>.Value, ",")
See this page for more info on working with multivalued parameters: http://msdn.microsoft.com/en-us/library/dd255264.aspx