Can anyone tell me, how i can insert the data from one table to another table using Maps.
Scenario: Lets say , table A which is having 1, 2 , 3, 4, 5 fields. and table B is also have the same fields which are in table A and 6, 7 also. here i want to insert the 1, 2 , 3, 4, 5 fields data from table A to table B using Maps.
please helpme out on this (if possible, with example)
;This Site will help you to insert record a map.Also You will use below code to print map values.
mi = new MapIterator(mapGroupVariablesValues);
I think he wants the Map object, not the Map_Class…
I don’t think you’re supposed to insert into maps like that because they don’t define database objects. I thought they were more for associating a field with multiple tables and viewing/accessing data.
To do what you’re talking about, which isn’t normal I don’t think…I’d think you’d need to overwrite the insert() method on the actual map, then literally do:
tableA.field1 = this.field1;
tableB.field6 = this.field6;
Here is an example of how to update/build your address with the address map…maybe this will get you started.
select firstonly address forupdate;
I don’t think you should use either a map (foundation class) or a table map (data dictionary object).
The simplest solution - on tableB write a method initFromTableA(TableA _tableA), which will initialize fields from A to B.
This is a typical pattern used throughout AX (search AOT\DataDictionary\Tables for initFrom*() methods)
Another option is to use a method like buf2buf() from Global class (or create one that is better suited for your specific needs).