Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server Reporting Services - Set default value for multi-value report parameter

I have a report in SSRS and one of the parameters I use is Cities. The user can select from a list of cities to pull the report for that location, or multiple locations. My datset is simply a select * from tblCities. When I run the report, I do see that one of the options is "Select All." But, I'm wondering - is there a way I can get this "Select All" option as the default value, so that by default all cities are selected?

And, along those lines, but a separate question - is it possible to make this drop-down optional? I have tried the allow NULLS checkbox, but for multi-value parameters, it seems SSRS does not allow this.

FYI - I have only begun using SSRS; know very little about it.

like image 905
SeanFlynn Avatar asked Dec 09 '09 21:12

SeanFlynn


People also ask

How does SSRS deal with multiple valued parameters?

The multi-value parameter allows us to pass either one or more than the input value to the report. Also, it offers a “Select All” option that helps to select all parameter values. Now, we will create an example of the multi-value parameter in SSRS.

Can a parameter be referenced in multiple datasets in SSRS?

If you are referring to a paginated RDL report, yes. You would need to use cascading parameters, bound to different datasets.

What is cascading parameters in SSRS?

Cascading parameters provide a way of managing large amounts of data in a paginated report. You can define a set of related parameters so that the list of values for one parameter depends on the value chosen in another parameter.


1 Answers

is there a way I can get this "Select All" option as the default value, so that by default all cities are selected?

Yes you can.

  1. Open the Report Parameters dialog: Layout tab, right click anywhere on the canvas that is not the report, select Report Parameters
  2. Select the parameter (cities in this case), from the list on the left
  3. Select the appropriate default setting in the default section, lower righthand corner

One option is where you can statically define a value. IE: =0 or whatever the value is for the Select All option. FYI: I've found that what works in the Visual Studio preview doesn't work when live.

Another option is if the list of cities comes from a stored proc, you order the output of the sproc so Select All is at the top of the list. Then you select the radio button under the static value one (can't remember, not at work to check ATM) - you'll have to select the dataset the sproc is associated with, then the column that the value comes from.

is it possible to make this drop-down optional?

When you say "multi-value", are you actually able to select multiple values from the list? IME, all you get is a drop down & can only select one of the options available.

Allowing null is just an accepted value - the optionality is really handled in the query so that if a sentinel value is provided then the criteria isn't included in the query. IE:

AND (@cities IS NULL OR t.city = @cities)

That's quick & literally dirty. ORs are poor performance.

like image 194
OMG Ponies Avatar answered Jan 22 '23 22:01

OMG Ponies