Hi All today i am covering a small topic which is Maps in AOT
Maps are nothing just an 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.
EXAMPLE:
I have 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 in under Fields node in Map (drag and drop from EDT)
Now the next thing I need to do is to associate the fields in map 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. Like
And the associate fields with fields in MAP
Now I have created a method called printInfo under method node in Maps, which print the value of the map field AccNumber.
public void printInfo()
{
info(strFmt(“Map : AccountNum :%1”,this.AccNumber));
}
Similiarly I have create same methods under method nodes of CustTable and VendTable which are printing their respective AccountNumber fields
Now finally I have created a job see below I am not describing every line as I have added comments above the line.
When I run this job see what happens
Neat Explanation……..
Thanks alot sir
Hi asimgreat. i understood ur article but exactly what is the use of AOT map?. using that can we update, delete record available in the mapping tables ?. Please let me know
Thanks in advance..
Thanks Johnkrish,
Yeah, so by using AOT map , we can have the leverage of using any method of the table that we have mapped within our AOT map. By seeing the example, the same map is calling the methods within the tables i.e. Custable,VendTable
thnx bhai very neat explanation
Hi
I have a question on this can we have a more than one mapping for same table.
like in your Map Test: AccountNum there is CustTable mapping with CustTable.AccountNum
can I have another CUstTable mapping like AccountNum to CustTable.AccountNumSecond ?
Thanks for making it simple…
Someone is copying your posts and publishing as theirs
https://gearupdax.blogspot.co.uk/2014/10/how-to-create-use-aot-maps-in-ax2012.html
Thanks for notifying
Whatever you were explaining is good. But the thing is how to get the original account number from the cust table and the vend table.
May i know the specific?
If i understand your question correctly. You mean how we can write and read the values of Cust and Vend table records.
Ans: We have several examples within AX. like we have a table ‘CustVendPaymProposalLine’; which has a method ‘custVendTable’ in which we are setting the map.
case ModuleCustVend::Cust :
custVendTable = CustTable::find(this.AccountNum);
break;
case ModuleCustVend::Vend :
custVendTable = VendTable::find(this.AccountNum);
break;
Similiarly for retrieving we have table AgreementHeader ‘initFromCustVendTable’.
How this explain.Please let me know If there is something else needs to be described.
Thanks for good explaining
In RDP Report we use next two lines , can you explain that
fieldMapping = new Map(Types::String, Types::Container);
query::insert_recordset(EGCBranchCollectedTMP02, fieldMapping, query);