Creating a Composite Report

This tutorial demonstrates how to create composite reports by embedding existing report definitions and listing specific record set entries.

Embedding a Report Definition

In this section demonstrates how to embed report Product Order Report.bpmrptdesign which we created in chapter Creating and Running a Report with Table Layout and computed Column. In case you do not already have this report present in your report folders, you can import it from the following zip file:

all-tutorials.zip

You find it in the reports/dat folder. In this location you also find the two composite reports we will create in this tutorial, Composite Report and ProductOrderParameterReport

To upload the existing report definition:

  1. Right-click the Personal Report Definitions folder and select Upload.


  2. In the Upload dialog browse to the example report Product Order Report.bpmrptdesign in the reports/dat folder and click Upload and OK.


To create our composite report, click the Add icon. Configure the report as follows:

  1. In the Data Set tab select Record Set

  2. In the Data Set - Available Columns tab select the descriptors CustomerId, CustomerName and OrderedItem.

  3. Click the icon to move these columns into the Selected Columns section.

  4. In the Layout tab select Composite Report

  5. Click the Source button to switch to the source editor.

  6. In the My Reports tree click the Product Order Report and drag it to the HTML source canvas.

  7. Now the following code appears in the HTML source pane:

  8. Enter a heading for your embedded report.

If you go to the Preview tab, you can view the resulting embedded Product Order Report report.

Resulting Composite Report
Figure: Resulting Composite Report

Go to the Storage tab and save the composite report created in the preceding sections, e.g. as Composite Report.

Save the Report Definition
Figure: Save the Report Definition

Displaying specific Record Set Columns

Now we add an overview on specified columns to our our composite report. For each record set we print the customer name, Id and ordered item.

  1. In the Layout tab enter the following code:
    <h1>Customer Record Sets</h1>
    
    <ul ng-repeat="record in recordSet">
       <li><b>Customer</b>: {{record.CustomerName}} - {{record.CustomerId}}</li>
       <li><b>Item ordered by Customer</b>: {{record.OrderedItem}}</li>
    </ul>

Go to the Preview tab to view the result. On top we see the embedded report, followed by the list of the specified columns for each record set. Note that for large report definition previews you need to scroll down to view the entire result.


Figure: Composite Report with record set items

Viewing Record Sets grouped by a Parameter

Now we like to group the record sets by the name of the customers.

Add a Parameter to the Report to embed

Before we can use the parameter for CustomerName, we need to add a parameter filter to the Product Order Report:

  1. Click the Product Order Report in the My Reports tree to open it
  2. Switch to the Data Set tab
  3. Click Add Filter to add a filter
  4. From the drop-down list select CustomerName in the Descriptors section

  5. Select operator Equals
  6. The filter needs to have a value so that it can be accessed as parameter in a composite report. Enter any name.
  7. Make the filter parameter by clicking the Add Parameter icon

  8. Go to the Storage tab and save the edited report, e.g. as ProductOrderParameterReport

Filter the embedded Report in the Record Set

We add code to our composite report definition to print an embedded ProductOrderParameterReport for each customer.

  1. Click the composite report definition we created in the previous section in the My Reports tree to open it
  2. In the Layout tab click the Source button to open the source editor
  3. Enter the following syntax:
    <h1>Customer Record Sets</h1>
    
    <ul ng-repeat="record in recordSet | unique:'CustomerName,CustomerId'">
       <li><b>Report for Customer</b>: {{record.CustomerName}} - {{record.CustomerId}}<br />
       <br />
       <sd-report-frame parameters="{{'CustomerName='+record.CustomerName}}"
          path="/realms/carnot/users/frank/documents/reports/designs/ProductOrderParameterReport.bpmrptdesign">
       </sd-report-frame></li>
    </ul>

In the Preview tab view the result. For each customer, the embedded report is displayed.

Embedded Report with Parameter
Figure: Embedded Report with Parameter