Microsoft Dynamics AX 2012 :Understanding Related Field and Fixed Field relation on Ax Tables

Hi All,

Field Fixed relation

Suppose we have three tables

1) Player Table  2) Footballer 3) Cricketer

Player Table with following fields

  • PlayerName (string)
  • PlayerBenefits(string)
  • Player Type(Enum  contains Cricketer and Footballer)

FootBaller Table with following fields

  • Category (Enum contain A,B,C)
  • FootBallerCode(string)
  • Salary (real)

Cricketer Table with following fields

  • Category (Enum contain A,B,C)
  • CricCode(string)
  • Salary (real)

Here is how they all created:

Tables.jpg

Now populate some data in Footballer and Cricketer table

Second

Third

Scenario

Now For Player Table

If we select  ‘Player Type’ = Footballer then on Player Benefits field on the Player table ,lookup should be open showing the records of footballer and similiary with the case of cricketer,for this to achieve we can use the relation called ‘Fixed field’ to accomplish this.

So go to the Player table under realtion node and create a field fixed relation and here it is what I have done

Four

  • It says that  PlayterTable.PlayerType ==0(since Player Type(Enum  contains Cricketer which has a value in database equal ‘1’ and Footballer has ‘0’) you can verify by navigating to base enum and view its properties,
  • So it mean if the PlayerTable.PlayerType == Footballer then

PlayerTable.PlayerBenefits == Footballer.FootballerCode(shows the lookup of Footballer data)

And similar is the case with Cricketer see below now

Fifith

So now lets insert some data on Player table

Sixth

And

7th

Related Field Fixed

Note: below is copied from external resource

This relation restricts the records selected in the related table. Only records that meet the condition are selected.
The condition is ANDed with your relation.

Secondary table filtration can be done on the basis of relation set using related field fixed.

Example:
Primary Table:tableA(col1,col2,col3)
Secondry Table:tableB(col4,col5,col6)-col5 is an enum & can contain values 0,1,2.

tableB has 6 records as following

col4      col5     col6
1)      —           0          —
2)      —           1          —
3)      —           2          —
4)      —           1          —
5)      —           0          —
6)      —           1          —

We can set the related field fixed relation in tableA as
1==tableB.col5

It will give the lookup of 3 records of tableB i.e. 2,4 & 6th records.

Based on similar understanding I have implemented following

8th

 So we have four records in InventoryPhoneTable

9th

But when we click the look up,only showing two record

1oth

Please let me know for any concerns

Advertisements

9 responses to “Microsoft Dynamics AX 2012 :Understanding Related Field and Fixed Field relation on Ax Tables

    • Yeah, so basically i added to relations, first is if the Player Type == 0 then i set PlayerTable.PlayerBenefits == Footballer.Footballer.Code… using “Normal” relation

  1. Field fixed Relation example seems correct but i have doubt on Related field fixed example. In field fixed relation example, Relations are made on primary table (player) and record restricted of primary table itself, But in Related field fixed example Relations are made to the primary table (phone table) and Record restricted of Primary table only, For Related field fixed Record should be restricted of Related table (please correct me if i am wrong)

  2. Hi,
    Nice post.
    1.The relations are basically used to build lookups is that right?
    2.Also another thing, suppose if I change the values of a field which is linked with another tables, so by default will the values be updated to their linked tables?

    Thanks in advance.

  3. Pingback: AX7 – Notes about the index and relations – Marvin's Dynamics Notes·

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