A master detail report can be created by grouping the details in the Details row of Table data region. For each associated row from the master record, the grouped details are repeated. Consider that you want to create a report that shows titles and corresponding values of quantity, price, and total price. You also want these details to be categorized according to the customer name. In this case, the details go to the details row of the table, and these details are repeated for each customer.
This tutorial guides you through the steps to create a master detail report by grouping a part of data in a Table data region.
Note: This tutorial uses sample CustomerOrders data set.
After you complete this tutorial, you will have a report that looks similar to the following.
To create a databound table,
Drag-drop the selected fields onto the design area. A table with its column bound to the fields is created. You can see the Header row and Details row of the table are automatically filled with the data.
Alternatively, you can first drag-drop the Table data region onto the design area of the report and then populate the data by dragging and dropping the fields onto the details row.
We will now add one more column to the table that will display the total field. For this, you need to click inside the table to display the column handle, and then click the plus sign. We will now have a table with two rows and four columns, respectively.
{Quantity} * {Price}
Note: The Data Set Name property of the table is automatically set to CustomerOrders data set.
Let us add more meaning to the report by adding groups. We will group the details according to the customer names, and will have the column labels repeated for each group. So, the master part of the table will consist of first name and last name of the customer along with the static text for the labels in the detail part. To do so, let us add two row groups, as described in the following sections.
First of all, delete the Header row of the table (these are not required in our report),
To add a group that contains the customer name,
Go to Group and select Insert Group.
This adds a row group above and below the details row.
Select the first text box of the added row group and set its value as following, {FirstName} {LastName}
{FirstName} {LastName}
Go to Row and select Below to add a new row for the header labels. Now your table looks similar to the following.
Note: The table groups are displayed in the adorner on the right side of the Table data region.
In the row group above the details row, enter the labels for the details as shown.
To group the details for each customer,
To obtain the sum of prices for each group,
{Sum(Quantity * Price)}
Note: You may need to resize and reposition the controls on the report to accommodate data, and for a cleaner look.