Search code examples
reporting-servicesssrs-2008instancereportingssrs-2008-r2

How to run a subreport multiple times in one report?


Is there a way to have a subreport run for every instance in a parameter list? My subreport is designed to only take one parameter, I just want to have the subreport returned multiple times in one report.


Solution

  • You can "tablefy" your parameter list :

    1. Create a query that will un-pivot your param list as a TABLE(INT).
      EX:

      SELECT IDField FROM
       dbo.TableValueFunctionToSplitCommaDelimitedListIntoTableOfInts(@MultiValueListParam)
      
    2. Add a table or matrix your report.

    3. Add a DataSet and set the result to the sp or query created in step 1.
    4. Set the DataSet of the table in step 2 to the DataSet created in step 3.
    5. Insert the SubReport into the detail of the new table.

    This should print once per detail band. You can set the parameter to Fields!IDValue.Value