Compartilhar via


Conditional Table Relations

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Define conditional table relations to filter the records in either the primary or the related table. Following are the conditional table relations that can be specified when you define the fields in a table relation:

  • Field fixed

  • Related field fixed

You create a conditional relation by right-clicking the
 AOT > Data Dictionary > Tables > YourTable > Relations > YourRelation 
node. Then click either Field fixed for Related field fixed.

The following table shows the characteristics of the two conditional table relations.

Relation Type

Format

Description

Field fixed

Field fixed

(Table.Field == <EnumValue>)

Restricts the records selected in the primary table. Only records that meet the condition are selected.

The condition is ANDed with your relation.

Related field fixed

Related field fixed

(<EnumValue> == Table.Field)

Restricts the records selected in the related table. Only records that meet the condition are selected.

The condition is ANDed with your relation.

Example of Field Fixed Conditional Relation

Fabrikam, Inc. receives clothing orders by telephone. When a customer places an order, the sales associate determines if the customer wants to buy clothes from the men’s, women’s, or children’s collection.

The Orders table has a CollectionTypeID column that stores which collection the order is related to. The possible CollectionTypeID values are defined by the CollectionType enum, which contains the Man, Woman, and Child values. There are conditional relations between the Orders table and each of the three collection tables (MensCollection, WomensCollection, and ChildrensCollection). One of the conditional relations is used according to which collection type the sales associate selects.

Using conditional relations makes it possible to look up information in three different tables from the same field in the Orders table. The table that Microsoft Dynamics AX uses is determined by the CollectionType enum value in the CollectionTypeID column in the Orders table.

Fabrikam, Inc.'s men's collection includes stylish, business, and leisure clothing. There's a ClothingCategoryID column in the MensCollection table, which is populated by the ClothingCategory enum. The ClothingCategoryID column is also in the Orders table.

When the sales associate enters a category into the ClothingCategoryID column in the Orders table, it displays a look-up list of the available items. The number of items in the look-up list (from the MensCollection table) is limited based on the value in the ClothingCategoryID column. This makes it easier to find the appropriate item because the items in two of the three men’s collection categories don't appear in the look-up list.

See also

Defining Table Relations

How to: Add a Relation to a Table

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.