<< Click to Display Table of Contents >> Navigation: User Interface Reference > Report Designer > Report Designer for WPF > Report Types > Master-Detail Report (Subreports) |
Interface Elements for Desktop > Report Designer > Report Designer for WPF > Report Types > Master-Detail Report (Subreports)
This tutorial describes the steps needed to create a master-detail report with hierarchically linked data 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 in the Field List and choose Add Parameter in the invoked context menu.
4.Select the created parameter, and in the Properties Panel, specify its options as shown in the image below.
5.Select Edit... in the report's context menu. Then, in the Edit dialog, click the ellipsis button for the Filter String property.
In the invoked Filter String 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, click the Save As button in the Toolbar. Then, in the invoked standard Save dialog, specify the folder and file name.
1.Next, switch back to the master report. Right-click the subreport and select Edit... in the invoked context menu. In the Edit dialog, click the ellipsis button for the Report Source 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, select Edit Parameter Bindings... in the subreport's context menu.
This will invoke the 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 Print 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.