Reputation: 482
I have a SSRS report in which i have a parameter which comes in a dropdown it is a multiselect parameter, now i want that at most user should be able to select only two values from the dropdown.
Upvotes: 2
Views: 1439
Reputation: 482
There are workarounds as suggested by @Kyle Williamson in his answer, but there is no exact answer possible as this facility is not present in SSRS
Upvotes: 0
Reputation: 2184
Although you can't stop the user from selecting more than two values, you can keep the report from being shown if they do. First, I created a red-text textbox at the top of my report that holds an error message. Something like:
You selected more than two values for ReportParameter1, try again...
Then, I set the visibility of this message with an expression (for hidden) set to =(Parameters!ReportParameter1.Count<=2)
. Now this error will show only when the user has selected more than two parameters.
I then hide the content of my report with a visibility expression of =(Parameters!ReportParameter1.Count>2)
. Note that you can simply put all your content in a rectangle and then hide the rectangle.
If your user selects more than two parameters, only the red error message is shown. If they select two or less, everything looks normal. I would also write your stored procedure in a way so that if a user selects too many values for the parameter, it won't return any data.
Upvotes: 2
Reputation: 12243
This is not possible. A multi-select parameter is that and just that: a parameter that lets you select multiple values.
If you will always only have two values that need selecting, the easiest way of implementing this would be to have two single value parameters labelled as Value 1
and Value 2
which are then both referenced in your report query.
Upvotes: 1