When you want to separate the details from the master report, you can create two separate reports and embed the detail report in the master report using Subreport control. A parameter is passed from the master report to detail report to filter the details.
Caution: Semantic reports created using legacy Flash designer cannot be used as Subreport in Web Designer.
What You Will Learn
This tutorial guides you through the steps to create a Master-detail report using subreport in ActiveReports Web Designer.
After you complete this tutorial, you will have a report that looks similar to the following.
![](images/MasterDetailReport-Subreport.png)
(Parameter1 = Canada West)
Access the ActiveReports Web Designer and Add Data Set
- On the ActiveReports Server Report Portal, click Create report.
The ActiveReports Web Designer opens in the new browser tab.
- Select Blank Page Report template and then click Choose Data.
- Select SalesByRegion data set from the available shared data sets.
- Click Create Report. The SalesByRegion data set is added to the report.
Create Master Report Layout
To create a master report, we will use List data region. The List data region will contain TextBox controls to display the data, and a Subreport control to display detail report. The List data region repeats any report control it contains for every record in the dataset.
- Drag and drop List data region
onto the design area of the report.
- Drag and drop two TextBox controls, TextBox1 onto the list and TextBox2 above the list.
- Drag and drop the Subreport
control onto the list. Arrange the controls such that the report now looks like the following.
![](images/MasterDetailReport-listtextboxsubreport.png)
Verify that the hierarchy of the controls added in the report is as follows. This can be viewed in Explorer by clicking
.
![](images/MasterReport-Explorer.png)
Add Parameter to the Master Report
Let us add the parameter that will be passed to the detail report to display the details accordingly.
- From the top right corner of Web Designer, click the Data icon
.
- Click Add next to Parameters. A parameter named Parameter1 is added.
- Click Parameter1 to edit parameter properties. You can change the Prompt to a more understandable text, such as 'Enter region name'.
The following image shows how these properties are set:
![](images/MasterReport-Parameter1.png)
- Go to From Query tab under Available Values and set the following properties.
Property |
Value |
Data Set Name |
SalesByRegion |
Value Field |
Region |
Label Field |
Region |
The following image shows how these properties are set:
![](images/ParameterizedReport-Parameter1-AvailableValues.png)
Note: The name of the parameter in master report and detail report (subreport) should be same.
Bind Data to the Report Controls
- Select TextBox1 and enter the expression
="Store ID: "& Fields!Store.Value
.
- Select TextBox2 and enter the expression
="Details for region: "&Parameters!Parameter1.Value
.
- Set the Data Set Name property of the List data region to the SalesByRegion data set.
Let us embed the report created in Tutorial 3: Create Parameterized Report as a detail report and pass the parameter as filter to the detail report data from the master report.
-
To embed the detail report to master report,
- Select Subreport control.
- From the Properties pane, set the Report Name property to the detail report's name, that is, 'Detail Report'.
To use the parameter (Parameter1) passed from the master report to the detail report as a filter, set the parameter property as follows.
- From the Properties pane, go to Parameters property.
- Click Show Items and then select Add Item.
- Click
to view the parameter properties.
- Set the Parameter Name property to Parameter1.
- Click the radio button next to Value and select Expression... to open the Expression Editor:Value dialog box.
- Double-click Parameter1 from the Parameters field so that =Parameters!Parameter1.Value is entered as expression.
The following image shows how these properties are set:
![](images/Subreport-Parameter1.png)
- Click Save.
To use the parameter (Parameter2) as filter to store values,
- Similar to above steps, add another parameter.
- Set the Parameter Name property to Parameter2.
- Set the Value to =Fields!Store.Value expression.
The following image shows how these properties are set:
![](images/Subreport-Parameter2.png)
- Click Save.
The Parameters property of Subreport control now shows two parameters as shown.
![](images/Parameters_Subreport.png)
Add Title
- Drag and drop a TextBox control
above the List data region. If required, relocate the table to create space for the text box.
- Click inside the text box and enter the text 'Customer Orders (Master Detail Report)'.
Customize the Appearance of Master Report
![](images/masterreport-design.png)
Note: You may need to resize and reposition the controls on the report to accommodate data, and for a cleaner look.
-
To customize the text boxes with information on store id and details for region,
- Select TextBox1 and TextBox2, one at a time.
- From the Properties pane, set TEXT - Text Align property to Center.
- Set BACKGROUND - Color to Plum from the colors available on Web tab of the color pallet.
To customize the title,
- Select the text box with title.
- From the Properties pane, set TEXT - Text Align property to Center.
- Set BACKGROUND - Color property to Plum from the colors available on Web tab of the color pallet.
- Set TEXT - Font Weight property to Bold.
Preview and Save Master Report
- Click Preview
to view your report in the final output. You will be prompted to select the region name.
- Select a region and see how the details are filtered.
- Exit the preview mode by clicking Back on the left side of the designer.
- Switch to the File tab and click Save to open the Save dialog box. Enter the report name as 'Master Report' and click Save Report.
See Also