Thursday, April 18, 2013

Fixed Field Relation in AX 2012


Hello Friends,

This post we continue with Fixed Field Relation in Dynamics AX 2012. We use Fixed Field relation when we have 1:N relation. On certain condition one of the relation become active & other will remain deactivate. Let me use the same theme as MSDN - Clothing.

Lets say you have 4 tables

1. ChildernClothesTable
2. MenClothesTable
3. WomenClothesTable
4. ClothesOrdersTable

Create BaseEnum CollectionTypeId with the following elements:

0 - Men
1 - Women
2 - Children

Create Extended DataType CollectionTypeEDT of BaseEnum CollectionTypeId. Now use this EDT in your ClothesTable.

ClothesOrdersTable has the following fields:

1. ClotheId,
2. Name ,
3. CollectionTypeId and
4. Qty 

ChildernClothesTable, MenClothesTable and WomenClothesTable has the following fields:
1. ClotheId,
2. Name 

Case 1:

On ClothesOrdersTable we create a new relation to MenClothesTable and specify the follwing two relations:

1. Normal = ClotheId to ClotheId and

2. Fixed Field ClothesOrdersTable.CollecTionTypeId = 0 and SourceEDT = CollectionTypeEDT


This shows that the lookup to the MenClothesTable should show all clothes with the same ClotheId (Define in Normal Relation) AND clotheId will only bring from MenClothesTable as we are using type Men (Define in Fixed Field Relation) because we want to activate relationship for mens' clothes. We use 0 because Men is element 0 in the Enum.

Case 2:


On ClothesOrdersTable we create a new relation to WomenClothesTable and specify the follwing two relations:

1. Normal = ClotheId to ClotheId and

2. Fixed Field ClothesOrdersTable.CollecTionTypeId = 1 and SourceEDT = CollectionTypeEDT


This shows that the lookup to the WomenClothesTable should show all clothes with the same ClotheId (Define in Normal Relation) AND clotheId will only bring from WomenClothesTable as we are using type Women (Define in Fixed Field Relation) because we want to activate relationship for Womens' clothes. We use 1 because Women is element 1 in the Enum.

Case 3:


On ClothesOrdersTable we create a new relation to ChildernClothesTable and specify the follwing two relations:

1. Normal = ClotheId to ClotheId and

2. Fixed Field ClothesOrdersTable.CollecTionTypeId = 2 and SourceEDT = CollectionTypeEDT


This shows that the lookup to the ChildernClothesTable should show all clothes with the same ClotheId (Define in Normal Relation) AND clotheId will only bring from ChildernClothesTable as we are using type Childern (Define in Fixed Field Relation) because we want to activate relationship for Childern clothes. We use 2 because Childern is element 2 in the Enum.

Hope it will help you to understand Fixed field Relation in Dynamics AX.........

Happy DAXing...... :)

Sample XPO Link :
https://docs.google.com/file/d/0B7UC6CtWeBQTWnVSWUNvUEkyZVU/edit?usp=sharing

No comments:

Post a Comment

Enable UAT database over OneBox DevTest environment using JIT

 Dear Friends, In this Article I will show you how to enable UAT database access for Development machine using just-in-time (JIT). Many time...