Configuring a complex association
Configure an advanced association when you cannot use a simple association because your join conditions are too complex.
By default, associates are created as simple associations; however, you can convert them to complex associations.
- In the navigation pane of Dev Studio, click Records.
- Expand the Data Model category, then click Associations.
- Click in the row of the association that you want to configure.
- Click the Data Access tab.
-
Click Convert to advanced configuration.
After you convert to an advanced configuration, you cannot convert back to a simple configuration.
- In the Class name field, in the Class association section, enter a class that is being linked to the context class.
- In the Prefix field, specify a short alias for the joined class and its properties. The prefix must be used to qualify all references to properties in the class on all tabs in the rule form.
-
In the Class name field, select a class to be the primary class
for the association.
If this work type is derived from Work-, a concrete class is required whether you want to join to an implementation class, or to a framework class.
-
To enter filter conditions, click Edit conditions.
- To add a filter, click Add join filter.
-
In the Condition field, enter a label that uniquely
identifies the condition in this row.
The label is used in the Filter conditions field to combine conditions into a single logical condition.
-
In the Column field, select a top-level,
Single Value
property associated with the class you specified in the Class name field.Select a property that is an exposed column in the database table that holds instances of the class. -
In the Value field, select the top-level,
Single Value
property in the association’s Applies To class that corresponds to the property value entered above.This property must also be an exposed column. - Repeat these steps to add additional filters.
- Optional:
In the Filter conditions field, modify the default
expression, if necessary.
Using the labels entered in the Condition field, enter a logical expression that defines how the system combines the criteria into an overall logical condition at runtime. The expression can include parentheses and the operators AND and OR.
By default, if the Filter array contains two or more rows, the logic statement uses AND, which requires that all match criteria are met.
For example, if the table contains four rows labeled A, B, C, and D, you can enter: (
A
ORB
ORC
) ANDD
in this field.
-
In the Type field, select the type of join to use.
The default choice,
Only include matching rows
, uses an inner join, in which the association only includes rows in each class that have a matching row in the other class (referred to in SQL as an inner join). Use one of the other options to use an outer join for the association, in which all rows of one of the classes are included in the association even if they have no matching rows in the other class.