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.

  1. In the navigation pane of Dev Studio, click Records.
  2. Expand the Data Model category, then click Associations.
  3. Click in the row of the association that you want to configure.
  4. Click the Data Access tab.
  5. Click Convert to advanced configuration.
    After you convert to an advanced configuration, you cannot convert back to a simple configuration.
  6. In the Class name field, in the Class association section, enter a class that is being linked to the context class.
  7. 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.
  8. 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.

  9. To enter filter conditions, click Edit conditions.
    1. To add a filter, click Add join filter.
    2. 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.
    3. 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.
    4. 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.
    5. Repeat these steps to add additional filters.
    6. 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 OR B OR C ) AND D in this field.

  10. 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.