Subreports allow you to combine unrelated reports into a single report. It is a report within a report. You can combine data that cannot be linked and present different views of the same data in a single report.
Difference between Subreport and main report −
It is used as an element in the main report and cannot be used as single report.
A Subreport cannot contain other subreports.
It can be placed in any report section and the entire subreport will print in that section.
It doesnt have page header or page footers sections.
Unlinked Subreports
Unlinked subreports are standalone reports and their data is not linked to data in the main report. An unlinked subreport does not have to use the same data as the main report; it can use the same data source or a different data source entirely. Regardless of the underlying data sources, the reports are treated as unrelated.
Linked Subreports
Linked subreports use data that is coordinated with data in the main report. The program matches up the data in the subreport with data in the main report. If you create a main report with customer information and a subreport with order information and then link them, the program creates a subreport for each customer that includes all their orders.
Subreports can be linked with data-passing links or with subreport filters.
Inserting Subreports
You can insert a new report or an existing report as subreport in a main report. The subreport has similar characteristics as the main report. The data source to be used in subreport must be similar to data source that is used in main report and it must also be located on the same BI repository. You can also choose a different source connection but it should have a field to link to main report.
A subreport cant be inserted into another subreport. A subreport can be placed in any report section and the entire subreport will print in that section. However, a subreport cannot stand on its own. It is always inserted as an element into a main report.
Formatting Subreports
How to Insert a Subreport to a main report?
Go to Insert tab, click Subreport → The program displays an element frame.
Move the cursor to where you want it to appear in the report, and click to place it.
The Insert Subreport dialog box appears → Select create a new report → Type a name for the report in the Report Name text box. (You can also insert an existing subreport).
Option | Description |
---|---|
Use Main Report Data Source |
|
Connect to a new Data Source |
|
Choose an option from the Data Connection area, and click "Next". If you choose Use Main Report Data Source it will open Query panel to add objects in the report.
If you select connect to a new Data source, it will open New Data source connection window from which you can choose a new data source.
Once you choose new data source, you need to define the relationship between the main report and the subreport.
Once you click on "Next" it will prompt you to choose a Sub Report type like Detailed, Chart, Total, Custom.
Click on finish → it will show in the Structure of the main report. If you click on Page tab it will show the data of Subreport in the main report.
To insert an existing report as a subreport
On the Insert tab, click Subreport → The program displays an element frame.
Move the cursor to where you want it to appear in the report, and click to place it.
The Insert Subreport wizard appears → Select Use existing report, and then click Browse.
The Open dialog box appears → Select the report that you would like to use, and then click Open → Click Next.
If the report you selected contains parameters, the Data Passing Links page appears.
Set up the appropriate links, and click "Next". The Create Subreport Filters page appears → Create links between your main report and subreport by clicking Add → Click Finish.
The report that you selected is added as a subreport.
To save a subreport as a main report
You can also save a subreport as a main report.
Right click on the subreport frame, and click Save Subreport As → Save As
Type a new name for the subreport → Click Save.
The subreport is saved as a main report and you can open it and use it.
Edit the properties of a subreport
You can edit the properties of a subreport after you have inserted it into your main report. To format subreports −
Right click on the subreport frame and click Format Subreport.
The Format dialog box appears → Edit the values.
For example, you can change the name of the subreport, edit the font, size, color, etc.
Click Close.
To combine two unrelated reports
Create the report you want to be printed first as the main report.
Create a new subreport.
Place the subreport into the Report Footer and it will print immediately after the main report.
Creating an on-demand subreport
On-demand subreports can be especially useful when you want to create a report that contains multiple subreports.
The difference between regular subreports and on-demand subreports is that the actual data of an on-demand subreport is not read from the data source until the user isolates it. This way only data for on-demand subreports that are actually viewed will be retrieved from the data source. This makes the subreports much more manageable.
To create an on-demand subreport: Place an ordinary subreport in your main report. Right click on the subreport, and click Format Subreport. Click the Subreport option, and select On Demand.