Friday, December 19, 2014

Session 17: SSRS Subreports
AnandFriday, December 19, 2014 1 comments


                             Session 17: SSRS Subreports



SSRS Subreports are extremely helpful, when we need to embed multiple reports in a single report.
The main report serves as a container for multiple sub-reports.
SSRS gives us complete control over what parameters to be passed to the sub report.
Many times this is useful in matrix reports too.

Lets look at an example of a sub-report.

We are going to create a main report with 1 parameter.
As soon as someone selects a parameter, relevant data is displayed + the sub report is also filtered and displayed in the main report itself.

Step 1: Create a main report (Steps to create a basic report can be found in the previous tutorials)
I have the following dataset:

SELECT [TerritoryID]
      ,[Name]
      ,[CountryRegionCode]
      ,[Group]
      ,[SalesYTD]
      ,[SalesLastYear]
      ,[CostYTD]
      ,[CostLastYear]
      ,[rowguid]
      ,[ModifiedDate]
  FROM [AdventureWorks].[Sales].[SalesTerritory]

  Where CountryRegionCode = @CRC



Step 2:  Create a parameter called CRC.

Step 3: Your Main report would look something like this.



Step 4: Now lets add a sub-report and pass in the same parameter to it.
Drag and drop a sub-report control from the toolbox.


Step 5: Now click on the sub-report properties.

Step 6: Lets us the previous tablix report that we created as our sub-report.

Step 7:
Choose the parameters tab, and configure the parameters

Step 8: click OK and hit preview.
You should be able to see the main and the sub-report.

In Category :
About The Author Anand Anand is a Microsoft Certified MCITP (Business Intelligence Infrastructure Using Microsoft SQL Server 2008), MCTS (SQL Server 2008, Business Intelligence Development and Maintenance) with 8 + years of experience in the Finance , Education, Healthcare, Banking and Insurance, Telecom domain focused on delivering software design, development, and data migrations from diversified data sources using Business Intelligence analysis tools..

1 comment: