SSRS: How to pass a sql query parameter from the main report to a subreport:

As you know, Sql Server can link reports easily with parameters.

One of my processes required sending a multiple values parameter that consisted of a concatenation of all IDs of the main report’s query, to a subreport.

To construct a multiple values parameter, follow these steps:

Create a hidden parameter on the main report:

On the available Values and Default Values tabs, use the drop down list to select the right value field in your query on the main report.

On the subreport, create a multiple values parameter:

Create the link to your subreport from main one.

At this stage, I picked the Text data type in order to link the reports with a textbox.

Tick “Go to report” and select the subreport from the “Specify a report” drop down list.

Click “Add” to add a parameter, as for the value click on Expression (fx) and type the following formula:

= SPLIT(JOIN(Parameters!ReportParameter1.value, “,”), “,”)

Save and Execute!

Advertisements
This entry was posted in SSRS and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s