Associations

Use an Association rule to define a relationship between two classes based on matching values in pairs of properties. A typical use of an association rule is to enable your application to automatically add a join to a report that displays properties from both classes referenced in the association.

An example is Association rule pxAssignedOperatorInfo defined in Work-, which relates each instance to an assignment instance in Assign- by comparing pxAssignedOperatorID in Work- to pyUserIdentifier in Assign-. These relationships are inherited by descendent classes of the classes on which the Association is defined; in this example, all descendent classes of Work- and Assign-. The primary use of Association rules is in Report Definition rules, where they are used to add an appropriate JOIN to the automatically generated SQL for a query defined on the Association’s class when that query also references properties in the associated class.

Association rules are one-directional, and only apply when the primary class of a Report Definition rule is the same as, or is a descendent of, the primary class of the Association rule. More than one Association rule may be defined between two classes, if there are multiple ways of relating or joining instances of the two classes.

To represent the relationship between two classes A and B, you usually need to define two associations:

  • An association where the Applies To key part is A, which associates data instances in B to those in A.
  • An association where the Applies To key part is B, which associates data instances in A to those in B.

Where referenced

Association rules are referenced in report definitions, to allow a report to contain data from both the instances of the Applies To class and the joined or associated class.

See the Pega Community article When and how to create an association rule to support reporting.