The SubReports sample demonstrates how SubReport control can be used to generate nested and hierarchical reports.
Sample Location
Visual Basic.NET
<User Folder>\Documents\GrapeCity Samples\ActiveReports 13\API\Section\SubReport\VB.NET
C#
<User Folder>\Documents\GrapeCity Samples\ActiveReports 13\API\Section\SubReport\C#
Details
When you run this sample, the blank Viewer form appears, with the drop-down list of the sample reports on the top of the form. Select the report from the drop-down list to have it displayed in the Viewer control. You can select from the following options.
- Simple SubReport - the basic sample report that demonstrates how to embed a report into another report. On selecting this report, rptSimpleMain report is displayed. The Detail section of this report contains the bound Textbox control to display the Category Name information and the Subreport control to display data from rptSimpleSub.
- Nested SubReport - the report demonstrates how to nest subreports to display main, child, and grandchild levels in a report. It uses rptNestedParent, rptNestedChildMain, and rptNestedChildSub reports.
- Hierarchical SubReport - the main report dataset with the SHAPE statement defines the hierarchical structure of the report that uses a subreport. It uses rptHierarchicalMain and rptHierarchicalSub reports.
- SubReport using the data set that contains relationship - the main report having dataset with the relation that is defined in code, in the DataSet.Relations property of the main rptDSRelationParent report. It uses rptDSRelationParent, rptDSRelationChildMain, and rptDSRelationChildSub reports.
- Master-detail report containing a SubReport - the sample report that demonstrates how to create a master detail report that uses a subreport. It uses rptMasterMain and rptMasterSub reports.
- Bookmark in SubReport - the sample report that uses bookmarks from the subreport. It uses rptBookmarkMain and rptBookmarkSub reports.
- Use a parameter in the SubReport - the sample report demonstrates how to set up a parameter in the data source of the subreport. See rptParamMain and rptParamSub for details.
-
To view the Dataset with multiple tables using SubReports - the sample report with the dataset that contains multiple data tables. The main report uses subreports to output multiple tables in a single report. See rptUnboundDSMain and rptUnboundDSSub for details.
Note: To run this sample, you must have access to the Nwind.mdb. A copy is located at [User Documents folder]\GrapeCity Samples\ActiveReports 13\Data\NWIND.mdb. If you are unable to access the data files in the sample, create the Data folder and place all the data files to this folder, or change the reference path to the data files within the folder according to your environment.
See Also