- Getting Started
- Administration Guide
-
User Guide
- An Introduction to Wyn Enterprise
- Document Portal for End Users
- Data Governance and Modeling
- Working with Resources
- Working with Reports
- Working with Dashboards
- View and Manage Documents
- Understanding Wyn Analytical Expressions
- Section 508 Compliance
- Subscribe to RSS Feed for Wyn Builds Site
- Developer Guide
Master-Detail Report using Subreport
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.
What You Will Learn
This tutorial guides you through the steps to create a Master-detail report using subreport in Wyn Enterprise Report Designer.
Note: This tutorial uses sample SalesByRegion data set.
After you complete this tutorial, you will have a report that looks similar to the following.
(Parameter1 = Canada West)
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.
Verify that the hierarchy of the controls added in the report is as follows. This can be viewed in Explorer by clicking .
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 Report 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'.
Go to From Query tab under Available Values and set the following properties - Data Set Name, Value Field, and Label Field, respectively as shown.
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 following expression in the Value field,
Store ID - {StoreID}
Similarly, select TextBox2 and enter the following expression in the Value field,
Details for region: {@Parameter1}
Note: The Data Set Name property of the List data region is already set to SalesByRegion data set.
Configure Subreport
Let us embed the parameterized report created in 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, 'Details Report'.
Note: As you select the Report Name property of Subreport control, you see two Report parameters. It is because the report passed in the Subreport control has two parameters. We will set these parameters later.
We will add two parameters in the master report since the subreport contains two parameters. Parameter1 will be used to filter the region based on the selection from the user prompt. Parameter2 will be used to filter the data based on store id values.
For Parameter1, enter the following expression as the value of the parameter:
{@Parameter1}
For Parameter2, enter the following expression as the value of the parameter:
{StoreID}
The report parameters will now look as shown in the following image.
To group the details for each store id,
Select the List data region and go to the Properties pane.
In the Group Expressions property, click Show Items and then select Add Item.
Click the radio button to display the fields and select the 'StoreID' field from the list.
Add Page Header
Go to the Report tab on top of the designer and select Add Header option.
Drag and drop a TextBox control in the page header area.
Click inside the text box and enter the text 'Customer Orders (Master Detail Report)'.
Customize the Appearance of Master Report
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,
Set the BACKGROUND - Color property for the page header of the report to '#f1f1f1'.
Align the text in the textboxes using the TEXT - Text Align (Left, Right, Center, and Justify.) and TEXT - Vertical Text Align (Top, Middle, or Bottom) properties. By default, these properties are set to General and Top.
Set the font size for the text in the page header to '14pt' using the TEXT - Font Size property.
Specify the border properties for the textboxes in the table using the BORDER - Width, Border - Style, and BORDER - Color properties. Set the border values to '0.25pt', 'Solid', and '#f1f1f1', respectively.
Preview and Save Report
Click Preview to view your report in the final output. You will be prompted to select the region name.
Select a region and again click Preview .
See how the parameter passed from master report obtains the details using the subreport control.
Exit the preview mode by clicking Back on the left side of the designer.
Click Save to open the Save dialog box. Enter the report name as 'Master Report' and click Save Report.