Skip to main content

Joins, associations, and subreports

You can relate properties in multiple database tables or classes to combine data in a single report. The following examples show you how to use properties to make relationships between classes or tables:

  • Use parent and child Case relationships to show child Case data along with the parent Case data. For example, assume you want to create a report that lists the purchase orders in a purchase request. You match the Case ID in the parent purchase order class to the Case ID in the child purchase request class.
  • Use Case and Assignment relationships to show how the system processes Assignments for a specific Case or a child Case. For example, assume you want to show the operators working on specific Cases. You match the operator identifier in the Case database table with the operator ID column in the Assignment table.
  • Use Case and history relationships to monitor performance. For example, assume you want to show the total amount of time required to resolve specific Cases. You match the Case ID in the Case data table with the Case ID in the history table.

You create class or database table relationships in a report definition. You can combine data from different classes by configuring class joins, referencing association Rules, or creating subreports.

Note: When you create a report in the Report Browser, a report definition Rule is created in Dev Studio.

Class joins

When you build a class relationship in a report definition, you configure a class join.

For example, assume you want a report that identifies the current Assignment and operator working on each candidate Case.

In the following image, click the + icons to view the details for how to configure this report:

You follow these basic steps to create a class join:

  • Determine the class to which you are joining.
  • Create a prefix that, in combination with the class name, serves as an alias for the joined class.
  • Decide whether you want to include or exclude instances that do not match.
  • Create a filter that describes how you relate the classes.

In the report definition form, you specify the class as the primary join. If this work type is derived from Work-, determine whether the join is to an implementation class or to a framework class. Doing so ensures that you are joining to the correct Data Set.

Caution: For performance reasons, avoid unnecessary joins when fetching database records. Avoid creating joins to classes you do not need to reference in your report.

Class join settings

On the Data Access tab of a report definition form, in the Class name field, you specify the class you are joining. For each class, in the Prefix field, you enter a text prefix. The prefix, combined with the class name, serves as an alias for the joined class and its properties. For example, to join to a work class that describes benefits enrollment Cases, you might use the prefix BE as shown in the following image:

Class join settings

When you add properties to columns in your report, the prefix helps you identify the properties in the joined class, as shown in the following image:

Class join prefix example

In the Type field, you specify how you want the system to join the data by selecting one of the following options:

Type Description
Only include matching rows

To only include instances in each class that have a matching instance in the other class (referred to in database terms as an inner join)

Select Include all rows in this class

To include all qualifying instances of the Applies To class of the Rule, even if there is no match found in the joined (prefix) class (referred to in database terms as a left join)

Select Include all rows in joined class To include all qualifying instances of the joined (prefix) class, even if there is no match found in the Applies To class (referred to in database terms as a right join)

Filter Conditions

You create a filter Condition that defines the relationship between the classes. The filter uses one or more properties to establish the relationship. Consider the Benefits Enrollment class join to the Candidate class. You would create a filter that matches the .pxCoverInsKey property in the child Benefits Enrollment class to the .pzInsKey property in the parent Candidate class, as shown in the following image:

Edit filter conditions report
Note: You cannot join to a class in a different database than the Applies To class of the report. The Column property must be an exposed column. You can use the Optimization tool to expose columns.

Association Rules

You use association Rules as another method to join multiple classes. Unlike a class join (unique to each report), associations can be reused in any report. Anyone with the appropriate permissions, such as managers, can also use associations when they create reports in the User Portal.

For example, assume you want to combine records in the Assign-WorkBasket class with records in work classes. You use the standard WorkBasket Assignment (pxWorkbasketAssignments) association Rule to join the classes.

When you add a column, you specify the association Rule class name as a prefix, and then select the properties in the class, as shown in the following image:

Association rules

When you add the association Rule prefix, it appears on the Data Access tab in the Associations section.

Check your knowledge with the following interaction:


A subreport is a report that is called by another report to provide data. Subreports enable you to reference results from any report definition in the main report. You can run a report definition that is used as a subreport like any other report. You commonly use subreports to satisfy complex reporting requirements. Using subreports to filter results allows you to include or exclude data. You can also use subreports to display aggregate calculations on specific rows in the main report.

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

Manage reports that use complex logic by including aggregated data from other reports. In your main report, you can use aggregate Functions, such as Is equal or Is less than, to include specific data from other reports. For example, in your main report about managers, you can reference a subreport that fetches the number of all employees who directly report to those managers. You can set a filter Condition to display only the managers who have more than 10 subordinates.

Subreports can be defined in classes that are different from the main report using join filters. You can access data in different classes similar to how you use a class join or an association. For example, in a financial report of the company, you can include a subreport with a property that fetches the most recent expenses of employees. This approach provides a way to filter the contents of the main report to display how the recent expenses affect the company budget.

The following interaction uses a subreport to display the Task information for each purchase request recently updated by each operator. In the center of the following image, slide the vertical line to view the subreport configuration on the left and subreport output on the right:

Check your knowledge with the following interaction:

This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

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