Skip to main content
close Search
Close search

Combining data from different classes using a subreport

Combining data from different classes using a subreport

Subreports enable you to reference results from any report definition in a main report. A report definition used as a subreport can be run like any other report.

Note: Consider subreports as a way of combining data using IN, HAVING, and WITH clauses.

Subreports can be defined in classes different from the main report. You can access data in different classes similar to the way you would use a class join or an association.

You commonly use subreports to satisfy complex reporting requirements. For instance, you can use subreports to filter results. This approach allows you to include or exclude data. You can also use subreports to display aggregate calculations on specific rows in a main report.

You use two different methods to create a subreport: join filters or aggregation.

Using join filters to create a subreport

Assume you want to display the task information for each purchase request recently updated by each operator.

Perform the following actions to create the report:

  1. Create a subreport for purchase requests that retrieves the most recent update date by update operator.
  2. On the main report in the Query tab, add columns for the requested data for each case and specify the subreport you want to reference.
  3. On the main report's Data Access tab, add the subreport.
  4. Create a join filter condition for the subreport. The filter defines how you want to join the subreport data to the main report. As shown in the following example, the subreport Update Operator column is matched to the update operator value (.pxUpdateOperator) in the main report.
    join filter 1
  5. On the Query tab, add a filter condition so that the update date value is equal to the update date value in the subreport.

When you run the report, it shows, for each operator, information about the purchase request the operator most recently updated. For each case, the report displays the update date and time retrieved from the subreport.

subreport example

The procedure for creating the previous example is described in the Community article When and How to Use subreports in a Report Definition. See Use Case 2.

Note: The examples in the Community article were created in Pega 6.2. The styles on the rule forms have been upgraded but the fields and functions are still applicable.

Using aggregation to create a subreport

You can use subreports to display aggregate calculations on specific rows. For example, assume you want to list the managers in the Engineering division who have more than ten direct reports.

Perform the following actions to create the report:

  1. Create a subreport that shows the managers who have direct reports, and how many they have. You use filter conditions to limit the data to managers who are part of the Engineering division and report directly to someone.
  2. On the main report's Data Access tab, add the subreport.
  3. Create a join filter condition to join data from the subreport to the main report where the value in the subreport's operator column matches the value in the operator column in the main report.
  4. Create a filter condition to use only data from the subreport where the number of reports-to instances is greater than ten.

When you run the report, it displays managers in the Engineering divisions who have more than ten direct reports.

subreport aggregate

The procedure for creating the previous example is described in the Community article When and How to Use sub-reports in a Report Definition. See Use Case 3.

For descriptions of the fields, you use to configure a subreport, see the Subreports section in the Help topic Report Definition Data Access tab.

Subreports can be configured to support many types of report requirements. For example, you may want to list the average number of direct reports for the managers in a specific division or list the operators who have not updated work items of a specific type within the past week. To see more use cases and design procedures, refer to the Community article When and How to Use sub-reports in a Report Definition.

If you are having problems with your training, contact Pega Academy technical support.

Did you find this content helpful?

100% found this content useful

Want to help us improve this content?

Suggest an edit

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice