The SubReport report item lets you display one report within another report. It is a container item just like the report sections and grows depending on its children. The screenshot shows a SubReport report item at design-time. This allows you to compose complex reports from disparate report sources. The data for each SubReport can be completely different. For example you could combine a product listing, a sales summary and a list of sales people each in their own sub reports, with each sub report getting data from a different source. You can also pass parameters to SubReports using the Edit Parameters collection editor.
Data Items cannot be used in page sections, because the latter are processed after the report data has been processed. At this moment the report data source is not available anymore.
Page sections are not related to the report itself, but are relative to the paper or screen. Thus page sections of nested/detail reports are ignored and only the page sections of the main report are visible.In order to have sections that repeat on every page similar to page sections, consider using an unbound group (no grouping criteria specified) and set the PrintOnEveryPage property of its sections to True. Be aware that you cannot use PageCount and PageNumber global objects in group sections.
To remove blank vertical space in the detail section of a SubReport, set the Height of the SubReport.ReportSource DetailSection to the height of the tallest item. Sections can grow to accommodate their children but cannot shrink to hide empty space. If you want the detail section to shrink only at runtime you can set the Height property of the DetailSection in the report constructor. Place the Height property assignment code just after the IntializeComponent() method call.
Click the subreport item that you want to change. The selected subreport properties are listed in the Property Browser.
In the ReportSource property, click the Edit Collection (…) button. Load a Report From window opens.
Click Edit Parameters button to add a parameter. Edit Parameters window opens.
Click the New button to add a new parameter mapping.
Assuming you have assigned the ReportSource property the Parameter Name drop down list will contain the names of parameters defined in the subreport report. Select a Parameter Name from the combobox to set the target for this parameter. from the combobox to set the target for this parameter.
Parameter Value combobox allows you to enter value directly, create an "
<Expression>" or a "
<New Report Parameter>".
When you are done, click OK.