Problem: How to create a sub
report in SSRS?
A sub report is a report item that displays another report
inside the body of a main report. Conceptually, a sub report in a report is like
a frame in a Web page. It is used to embed a report within a report. Any report
can be used as a sub report. The report that is displayed as the sub report is
stored on a report server, usually in the same folder as the parent report. You
can design the parent report to pass parameters to the sub report. A sub report
can be repeated within data regions, using a parameter to filter data in each
instance of the sub report.
Example:
In this article, I am going to show we can use a report as a sub report data
column.
Step 0:
Create an invoice detail report using the below set to add a parameter by
invoice date.
SELECT [Invoiceid]
,[itemid]
,[unitprice]
,[quantity]
,[TotalAmount]
,[lineitem]
,[linetotal]
,[invoicedate]
FROM [dbo].[OrderInvoice]
Where
Invoicedate=@invoicedate
Step 1: Go
to the designer, drag and drop sub report from the tool box or insert a column
if your sub report is summarized and I will show you both ways in here.
Step 2:
From the properties window select the sub report properties
Step 3: click on the use this report as a sub report drop down. Optional parameters if needed.
Step 4: go
to preview of the report and click on the invoice id and this will show both
reports at a time.
Results:
0 comments:
Post a Comment