A blog offering various X++ code snippets and tips for Microsoft Dynamics AX

Thursday, January 08, 2009

Fixed field and Related fixed field

This is an answer I gave to a question on a forum regarding fixed field and related fixed field:

Lets say you have ClothesTable and ClothesOrders.

ClothesTable has the following fields: ClotheId, Name and CollectionTypeId

MenClothesOrder has the following fields: OrderId, ClotheId, Qty OrderId could be a number sequence and Qty entered manually by the user.

CollectionTypeId has the following elements:

0 - Men

1 - Women

2 - Children

Example 1: Related Fixed Field

On MenClothesOrder we create a new relation to ClothesTable and specify the follwing two:

1. Normal = ClotheId to ClotheId (Best practice to specify this on the EDT but you have to do it here on the table too for this to work) and

2. Related Fixed Field 0 = ClothesTable.CollecTionTypeId.

This shows that the lookup to the clothes table should show only clothes with the same ClotheId (point 1) AND clothes that are of type Men (point 2) because the our table deals with order for mens' clothes. We use 0 because Menis element 0 in the Enum.

Example 2: Fixed Field

This kinda works the other way round:

Imagine you have a ClothesOrders table (generic) and you have seperate tables for MenClothesTable, WomenClothesTable and ChildrenClothesTable. Fixed field says that the specified normal relation (on ClotheId) to MenClothesTable only works if the CollectionTypeId of the current record is set to 0 (Men) else the relation is disabled.

If you need furhter clarification do not hesitate to ask.

If you any questions or comments e-mail me on: mirko@mirkobonello.com

No comments: