SSRS report repeat table for every parameter value

核能气质少年 提交于 2019-12-11 12:06:07

问题


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. I.E. 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.


回答1:


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.


来源:https://stackoverflow.com/questions/16679620/ssrs-report-repeat-table-for-every-parameter-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!