The Subreport control is a placeholder for data from a separate report. In ActiveReports, we recommend that you use data regions instead of Subreport controls wherever possible for better performance. The reason is that the report server must process every instance of each subreport, which can become burdensome in very large reports with a large number of subreports processed many times per report. Using data regions to display separate groups of data can be much more efficient in such reports. For more information, see Work with Report Controls and Data Regions.
Note: The Subreport control is not supported in FPL Page reports, only CPL. Also, you cannot use a Section report as the target of a Subreport in a Page report, and vice versa. But you can export any type of report to RDF and use that as the target of a Subreport in a section report. |
Subreports make sense when you need to nest groups of data from different data sources within a single data region, or when you can reuse a subreport in a number of reports. Here are some things to keep in mind while designing subreports.
- If you make changes to the subreport without changing the main report, click Refresh to re-run the subreport in the Preview tab.
- If you design the parent report in a stand-alone Report Designer application, save the parent report to the same directory as the subreport to render it in the Preview tab.
- If you set borders on the Subreport control and the body of the report hosted in it, ActiveReports does not merge the two borders.
- If the report hosted in the Subreport control cannot be found or contains no rows, only the border of the Subreport control is rendered.
- If the hosted report is found and does contain rows, the border of the hosted report body is rendered.
Parameters
You can use parameters supplied by the parent report to filter data displayed in a subreport. You can also pass parameters to a repeating subreport nested in a data region to filter each instance.
Subreport Dialog
Properties for the Subreport are available in the Subreport dialog. To open it, with the Subreport control selected on the report, under the Properties Window, click the Property dialog link.
The Subreport dialog lets you set properties on the report control with the following pages.
Note: You can select <Expression...> within any of these properties to open the Expression Editor. |
Name: Enter a name for the subreport that is unique within the report. This name can be called in code.
Tooltip: Enter the value or expression you want to appear when a user hovers the cursor over the subreport in the viewer at run time.
Subreport: Select the report to display within the subreport control. The combo box is populated with all of the reports in the local folder. Alternatively, you can drag a report from the Solution Explorer and drop it onto the report surface to create a new subreport.
Use this report’s theme when rendering subreport: Select this check box to have the subreport automatically use the same theme as the hosting report.
Initial visibility
- Visible: The subreport is visible when the report runs.
- Hidden: The subreport is hidden when the report runs.
- Expression: Use an expression with a Boolean result to decide whether the subreport is visible. True for hidden, false for visible.
Visibility can be toggled by another report control: Select this check box to display a toggle image next to another report control. This enables the drop-down box where you can specify the report control which, if clicked, toggles the visibility of the subreport.
Document map label: Enter an expression to use as a label to represent this item in the table of contents (document map).
Bookmark ID: Enter an expression to use as a locator for this subreport. You will then be able to provide a bookmark link to this item from another report control using a Jump to bookmark action.
The Parameters page of the Subreport dialog allows you to enter new parameters and remove or change the order of parameters using the X and arrow buttons. For each parameter in this list, there is a Parameter Name and a Parameter Value.
Each Parameter Name must exactly match the name of a parameter in the target report.
For the Parameter Value, enter an expression to use to send information from the summary or main report to the subreport target.
Element name: Enter a name to be used in the XML output for this subreport.
Output: Choose Auto, Yes, or No to decide whether to include this subreport in the XML output. Choosing Auto exports the contents of the subreport.