How To: Create & Use AOT Maps In Ax2012

  • Maps are also known as Table Maps/AOT MapsTable Map is a element/object the makes possible to link/associate map fields with fields(same type with different names) in different tables.
  • like, I have create a MAP with field (AccountNum) and Same field exist in CustTable and also in VendTable,so I can associate field in CustTable and in VendTable with Maps, so basically  Maps enables to access the fields with different name in different tables.
Procedure For Creating a AOT Map:
  • I created a Map by navigating to AOT>Data Dictionary>Maps and right click and new and gave it name ‘MapTest’.

  • I have created 4 fields under Fields node in Map (Best Practice drag and drop from EDT).

  • Now the next thing I need to do is to associate the fields in map witch i created with the fields in different tables, let say I am taking two tables (CustTable and VendTable).

Notice that above, four fields that I have created in Maps also exist in CustTable as well as VendTable with different names.


  • To associate fields, go to Mapping node, right click it and click New mapping and enter the table that you want to associate in Mapping Table field as following,



  • And the associate fields with fields in MAP.
  • Now I have created a method called printInfo under method node in MapTest, which prints the value of the map field AccNumber as following,


public void printInfo()
{
info(strFmt(“Map : AccountNum :%1″,this.AccNumber));
}
  • Similiarly I have created same methods under method nodes of CustTable and VendTable which are print's their respective AccountNumber fields.

Procedure For Accessing The Map:
  • Now finally I have created a job for accessing the map as shown below and you can observe comments above the code lines in the jobs that describe each line of code.

  • That's it we are done, when i execute this job the following output is produced.

Proud To Be a DAX Developer :-)

No comments:

Post a Comment