简体   繁体   中英

SSRS report repeat table for every parameter value

Guys sorry for the general question here but I have been looking on the internet and cant find a solution.

I have an SSRS report. There is one Parameter user must put in before running, @Location.

In the query its specified to only return results where that location is matched. IE where Company.location = @location

The results are displayed in a table. This all works fine, but I want to change the parameter to contain multiple values.....and then repeat the table for every location the user chooses.

Any help would be appreciated.

Step 1: Create a dataset for your multi-valued parameter, something like this:

SELECT LocationId, LocationName FROM MyLocations

Step 2: Create the parameter @LocationId , with available values from the above dataset, and set it to allow multiple values.

Step 3: Create another dataset along these lines for the actual table:

SELECT *
FROM MyDataTable tbl
WHERE tbl.Location IN (@LocationId)

Step 4: Create a List, bind it to the second dataset (select the list, find the "DataSet" property).

Step 5: Open the properties for the Details of the list, group on LocationId .

Step 6: Drop a tablix inside the list, and pick your fields from Dataset2 for that tablix at your leisure.

Step 7: ...

Step 8: Profit!


PS. There are several alternatives available to do this, including:

  • Use a list for the location in combination with a subreport for the actual table.
  • Use one big table, with groupings for location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM