AX 2012: Conditional Relations with Field Fixed and Related Field Fixed

Posted on Updated on

Conditional relations are used to filter records in parent or related table. We can define conditional relations by specifying fields in a table relation as:

  • Field Fixed    OR
  • Related Field Fixed

Consider a scenario of a call center. The operator’s responsibility is to receive calls and get the orders for a shoe store. The operator first has to determine whether the order is of men’s, women’s or kid’s collection. Once the collection is determined then the operator has to determine which particular shoes the customer is ordering. It would be easier for the operator if the system filters shoes records based on the collection type [Men, Women, Kids]. In this situation conditional relations using a Field Fixed method fits the solution.

First, we will be creating two base enums such that CollectionType is like [Men(0), Women(1), Kids(2)]:

Untitled

Then we will be creating three tables respectively for Men’s, Women’s and Kids’ collection. Note that all the three tables share the same set of fields:

Untitled

Then we will be creating the final table for storing Orders. Two important fields must be added to the orders table in order to get benefit from conditional relations:

  1. ArticleCode                – To lookup records into three different collection tables
  2. CollectionTypeId    – To distinguish table relations defined for the collection tables

Untitled

You can see in the picture how three relations have been defined. Each relation contains two fields, one used for determining the collection type and the other mapping to the respective collection’s Article Code field. Once all this is done, then now the system filters records for the user depending on the collection type the user has selected. See below how the system shows records from the men’s collection when CollectionType is set to ‘Men’:

Untitled

Below is an example of CollectionType set to ‘Women’:

Untitled

Below is an example of CollectionType set to ‘Kids’:

Untitled

Advertisements

One thought on “AX 2012: Conditional Relations with Field Fixed and Related Field Fixed

    Haythem said:
    December 23, 2014 at 3:03 pm

    Thanks !!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s