When and how to create an association rule to support reporting
Summary
Association rules provide an alternative to explicitly defined JOIN operations on the Data Sources tab of a report definition rule. V6.1 has 20+ standard association rules. You can create additional association rules to join to custom data classes, such as those created by data tables or external database connections.
Both explicit JOIN operations and association rules enable a report to present data from two related classes. However association rules work automatically when a manager or developer is building a report.
V6.1 contains more than 20 standard out-of-the-box association rules that define commonly used relationships (for example, between assignments and operator IDs). Before you create an association rule in your application, review the available standard association rules.
You can create additional association rules to predefine a JOIN-type relationship between instances of any two classes. For example, you can join work objects and custom data classes.
In this example, an association will be made between a work class and a data class containing information about departments within an organization. Each class contains a property that holds the name of the department. This property is the basis for the join.
Suggested Approach
To create an association rule:
- In the class in which the report will be based on, right-click on the SysAdmin category and select New > Association. On the New Instance of a Rule dialogue specify a Prefix value that is related to the data in the class you are joining to.
- On the association rule form, select the class you are associating with in the Class Name field. Only include matching rows is automatically selected in the Type field. This constitutes an INNER JOIN.
- In the bottom section, specify the property in the association rule's Applies To class that will be used in the association in the Property field. In the Join Property, specify the property in the associated class that will be joined to. Save the association rule.
- To take advantage of the new association rule, create a new report definition rule. In the Column Name field type the prefix created in the association rule. A list of available joined properties appears. Select the property to add to the report.
When you reference an association rule (by referencing the prefix in a Column Name field) the association rule is automatically added to the Associations section on the Data Access tab.
- Continue adding properties to the report as necessary. Click the Save & Preview button to view the report.
The Department Name and Sum of Orders values are from the work objects. The budget amount is from the joined data table ECorp-FW-ESupply-Data-Depts.