SSRS根据数据集字段创建所需数量的表(使用一个数据集)

时间:2018-11-08 16:36:02

标签: reporting-services

我有一个查询,该查询返回有关检查员的相关数据以及他们花多长时间来响应问题。唯一的参数是BeginDate和EndDate,因此对于任何给定的日期范围,检查员的数量都可以从0到100。

我只使用一个数据集,它包含一个“检查器”字段,我希望该字段可用作筛选器,以创建与检查器一样多的表。

我知道您可以在表格上设置过滤器,但是根据我(有限的)SSRS知识,您必须已经创建了表格,并且过滤器通常是硬编码的。 我需要的是,报表可以通过某种方式查看数据集中有多少个检查员,并将这些记录分组到自己的表中,并根据需要反复重复创建的Tablix。

这是在SSRS 2012中严格完成的,而不是使用ReportViewer,因为后端代码可以帮助我摆脱困境……

我没有提供任何代码示例,就像我说的那样,我知道您可以进行过滤,但是在基于数据动态地执行此类操作时,我感到茫然……抱歉。

1 个答案:

答案 0 :(得分:2)

根据报表设计,您可以...

具有分组的单个报告

1. Create a single tablix.
2. Create a row group by Inspector and then add whatever fields you need to the details section. 
3. You can optionally set page breaks between instances of your Inspector rowgroup from the rowgroup properties.

子报告方法

1. Create a subreport that accepts a parameter (InspectorID for example).
2. In the subreport filter the dataset using the parameter passed in so it only return data for a single inspector.
3. Add whatever controls you need to the report to handle a single Inspector
4. Create a main report 
5. Add a dataset that gives you a simple distinct list of Inspectors, this will be used to pass parameters to the subreport.  
    Lets assume it just contains a list of InspectorIDs.
6. Add a list control to the report and set it's dataset property to the dataset that contains your list of InspectorIDs
7. Right-click in the list control's 'cell' and insert a subreport. 
8. Set the subreport property to the subreport you created earlier and    set that parmameter IsnpectorID to your InpsectorID field.

这将为其找到的每个检查器实例生成一个子报告。

很抱歉,此答案的格式很紧急!