Question Status

Verified
Tony Hemy asked a question on 1 Mar 2013 12:58 PM

Is it possible to set a conditional table relation in AX in the sense that the value of a field in the parent table would dictate what child table the relationship is linked to.

Lets say for example I have field called "Account Type" and its an enum that can be Customer or Vendor.

I then have a field called "Account No.", I would like the relationship of my field "Account No." to be to the CustTable if "Account Type" == Customer and the VendTable if the "Account Type" == Vendor.

Is this possible?

t

Reply
Mukesh Hirwani responded on 1 Mar 2013 1:18 PM

U can add conditional relation to the table.

There are two types of 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.

 

Detailed description with scenario: http://msdn.microsoft.com/en-US/library/bb190115(v=ax.10).aspx

Mukesh Hirwani
http://mukesh-ax.blogspot.in/ 

   

Reply
Tony Hemy responded on 1 Mar 2013 1:33 PM

Thanks Mukesh, I have attempted this but perhaps I am missing something?

When I read this part of the MSDN article :

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.

I understand it to mean that I can add a relationship to a table to each of my possible enum values, however when I try that I do not seem to be able to lookup a table...

Do I have this incorrect?

t

Reply
Verified Answer
Janet Blake responded on 1 Mar 2013 4:08 PM

As an example please see table PriceDiscAdmTrans, which has relations to both CustTable and VendTable (among others).

Reply
Tony Hemy responded on 1 Mar 2013 4:09 PM

Thank you Janet. I will go take a look.

Much appreciated

t

Reply
Tony Hemy responded on 4 Mar 2013 9:24 AM

Thanks Janet, that helped me out greatly and I was able to abstract what I needed.

Reply
Janet Blake responded on 4 Mar 2013 9:36 AM

Great!

Reply
Verified Answer
Janet Blake responded on 1 Mar 2013 4:08 PM

As an example please see table PriceDiscAdmTrans, which has relations to both CustTable and VendTable (among others).

Reply