<< Click to Display Table of Contents >> Navigation: User Interface Reference > Report Designer > Report Designer for WinForms > Create Reports > Report Types > Master-Detail Report (Subreports) |
Interface Elements for Desktop > Report Designer > Report Designer for WinForms > Create Reports > Report Types > Master-Detail Report (Subreports)
This tutorial describes the steps needed to create a master-detail report using the Subreport control. For an alternative approach, refer to Master-Detail Report (Detail Report Bands).
To create a master-detail report using the subreport controls, do the following.
•Create and Customize a Detail Report
1.Create a new report and bind it to a data source. This report will be used as the master report.
2.Drop the required fields from the Field List panel onto the Detail Band. In this example, the following report layout is used.
3.Drag the Subreport control from the Toolbox and drop it onto the Detail Band.
1.Next, add one more blank report and bind it to the same data source. It will be used as a detail report.
2.Drop the required fields from the Field List panel onto the Detail Band. This tutorial uses the following layout for the detail report.
3.To add a parameter to the report, right-click the Parameters section and choose Add Parameter in the Field List.
4.In the invoked Add New Parameter dialog, specify the parameter's options as shown in the image below.
5.Then, click the report's Smart Tag, and in its actions list, click the ellipsis button for the Filter String property.
In the invoked FilterString Editor, construct an expression where the Category ID data field is compared to the CatID parameter. To access the parameter, click the icon on the right until it turns into a question mark.
6.To save the detail report, select File | Save As in the Main Menu. Then, in the invoked standard Save dialog, specify the folder and file name.
1.Next, switch back to the master report. Click the subreport control's smart tag, then click the ellipsis button for the ReportSource URL property and select the previously saved detail report.
2.Then, bind the subreport's CatID parameter used as a filtering criterion to the master report's CategoryID data field, which will serve as a source of the parameter value. To do this, click the subreport's smart tag and select Edit Parameter Bindings in the invoked actions list.
This will invoke a Parameter Binding Collection Editor. Click Add to add new binding. In the binding properties list, specify the data field to which you want to bind a subreport parameter and the name of the parameter that you want to bind.
The master-detail report is now ready to be generated. You can view the result by switching to the Preview tab.
Master-Detail Report (Detail Report Bands)
Copyright (c) 1998-2016 Developer Express Inc. All rights reserved.
Send Feedback on this topic to DevExpress.