How To: Create Related Field Fixed Relation In Ax 2012

Hi Friends,
Creating Relations in Ax 2012 is not that much difficult, today ll see how to do it in "3 Simple and Easy Steps" . Lets Start
Note: An Xpo for this example is provided at the end.


Step 1:




  • Create a BaseEnum  as AccTypeId , with elements as below 
  •             > Customer  - 0
                > Vendor      - 1




    • Create a EDT as AccTypeEDT and in the propertie's you will find a property as EnumType:   Set it to : AccTypeID(Our BaseEnum)



    Let say you have 3 tables as following:
    1. AccTypeTable.
    2. CustomerDetails.
    3. VendorDetails.

    Step 2:
    • Now create  table  AccTypeTable with fields AccountNum(String), AccType(Enum), DepartmentBelongs(String).
    • Note: When Creating AccType Field create a enumType field and in the properties find ExtendedDataType and fill that with our AccTypeEDT witch we created in step 1.



    • Create another table as CustomerDetails with  
    • Fields : AccountNum(String) and CustomerId(String) .
    • Create another table as VendorDetails with 
    • Fields:    AccountNum(String) and VendorId(String).

    Step 3: 
    • Create a Index For AccountNum in the AccTypeTable and make it as primary Key as shown below 



    • Create a Relation in the CustomerDetails and the relating table is AccTypeTable(Parent Table).
      Now 1st  add Normal relation between AccTypeTable and CustomerDetails using AccountNum and now RelatedFieldFixed,  assign the Customer BaseEnum (Customer-0) element to AccType in AccTypeTable, as shown.



    • Create a Relation in the VendorDetails and the related table is AccTypeTable(Parent Table) Now add Normal relation between AccTypeTable  and VendorDetails  using  AccountNum  and  now RelatedFieldFixed,  assign the Vendor BaseEnum (Vendor-1) element to AccType in AccTypeTable, as shown .


    That's it we are done and ready. Now enter the data in the AccTypeTable(parent table), and check out the CustomerDetails Table and VendorDetails Table....

    Here is the Xpo of The Above Example: Download Xpo .

    Proud To Be a DAX Developer :-)

    No comments:

    Post a Comment