Monday, February 20, 2012

Null multi-value parameters

How do you configure a multi-value parameter so it will allow the user to not enter the parameter?

I'm using integer multi-value parameters. I can't set the parameter to allow null, and when I preview the report and leave the parameter blank, it tells me to enter at least one value. I tried it with string parameters, and the report just doesn't run in preview if you don't enter any values, even if you choose "allow blank".

How do you specify a multi-value parameter to allow "empty" or "null"?Hope this will help you,
use TSQL for mutiple value parameter
select NULL as ID
union
select ID from table1|||I'm talking about Report Parameters in SSRS. Your SQL doesn't even use any parameters. How can this help?
|||Yes, I guess that he was also talkling about :-) Define a dataset which is filled with the parameters you want to display and in addition the NULL parameter (with the UNION mentioned above) You can also use something like "Select a value" as your display value for the NULL parameter. Then set the default value to non-queried and set the value to NULL. The Report will then open with the Report parameter list and set the "Select a value" value. In qour query you will have to handle the NULL appearance like the following mentioned example

WHERE
@.YourParameter IS NULL OR
YourColumn IN (@.YourParameter)

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||Ah, I see. This is for "Available values" in the parameter configuration. However, this wouldn't work for me, because when I deploy my reports the parameters are configured by a separate program, which then passes them to the webservice.

I did try what you suggested, and it didn't work as you describe. In preview, the values from the table were available to choose from, but the null value I created with UNION was not there.

I'm not sure how this would work anyway, because the parameter configuration is actually set to not "Allow null". So even if you could pick a null you might still get an error.

What I need is to be able to check "Allow null" for a multi-value parameter, but it gives an error when I try that. Does anyone even know why this is not allowed for multi-value parameters? It seems like a last-minute hack to protect some coding flaw.
|||then file it as a bug on connect.microsoft.com . The RS team keeps track of the posted bugs there.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment