ActiveReports 8
SubReport (Section Report)
Show AllShow All
Hide AllHide All

In section reports, you can use the SubReport control to embed a report into another report. Once you place the Subreport control on a report, use code to create an instance of the report you want to load in it, and to attach the report object to the SubReport.

You can also pass parameters to the subreport from the main report so that data related to the main report displays in each instance of the subreport.

When to use a subreport

Due to the high overhead of running a second report and embedding it in the first, it is generally best to consider whether you need to use subreports. Some good reasons to use subreports include:

Remove page-dependent features from reports to be used as subreports

Subreports are disconnected from any concept of a printed page because they render inside the main report. For this reason, page-dependent features are not supported for use in subreports. Keep any such logic in the main report. Page-related concepts that are not supported in subreports include:

Coding best practices

Use the ReportStart event of the main report to create an instance of the report for your SubReport control, and then dispose of it in the ReportEnd event. This way, you are creating only one subreport instance when you run the main report.

In the Format event of the containing section, use the Report property of the SubReport control to attach a report object to the SubReport control. 

Caution: It is not a recommended practice to initialize the subreport in the Format event. Doing so creates a new instance of the subreport each time the section processes. This consumes a lot of memory and processing time, especially in a report that processes a large amount of data.

Important Properties

SubReport Dialog

With the control selected on the report, in the Commands section at the bottom of the Properties window, you can click the Property dialog command to open the dialog.

General

Format

See Also

How To

Support Forum