开发者

"Select All" with SSRS 2008 Parameters

开发者 https://www.devze.com 2023-01-09 21:50 出处:网络
I want a parameter to load available values from a query (or whatever) and \"allow multiple values.\" When I do so the list begins with \"Select All.\"

I want a parameter to load available values from a query (or whatever) and "allow multiple values." When I do so the list begins with "Select All."

That's great, but there appears to be no way to default the parameter to "Select All" which is not accepta开发者_运维百科ble in my case. This particular report will have 8 optional parameters and if htey have to select "Select All" multiple times, this is hardly optional.

Therefore, I create my own "..All" option and the code to accept it. I can default to that, but then the user sees:

(Select All)
..All

This looks unprofessional. I've scoured the net and there doesn't appear to be an answer to this problem.

Is there any way to suppress (Select All) or achieve what I need? Any ideas?


Actually, the answer turned out to be that you have to set your Available Values and Default Values to the same Dataset and field.

If you do that, SSRS automatically selects every option in the list. It's not pretty, but it works.

Coincidentally you have to handle nulls in your dataset query too and replace them with some value such as "None." SSRS parameters will not allow the user to select "Allow multiple values" and "allow null values" at the same time. If your field contains nulls, SSRS will not throw an error but it will not default either.

I'm going to follow up with a blog post on this problem in the near future.


You can also use the Split() function to return multiple values.

For example, if the dataset is a bunch of varchars like

SELECT 'A' UNION SELECT 'B'

The following default value to select all for the multiple value parameter would be:

=Split("A,B",",")
0

精彩评论

暂无评论...
验证码 换一张
取 消