Copy values from -> to table

Hello everyone,

I want to copy values from 2 fields from one (table2) to another table (table1), but it’s not working.

This is my job.

void copyFromToTable()
{
table1 table1;
table 2 table 2;
;

ttsbegin;

insert_recordset table1(field1, field2)
select field1, field2
from table2

ttscommit;
}

Can anyone tell me what I am doing wrong?

Thanks!

What exactly happens? Do you get any error?

No, nothing is happening.

I am using AX 3.0

If you execute the select alone, do you get any data?

If you override insert() on Table1 and put a breakpoint there, does it get called?

Hi Martin,

Thanks for your help. I fixed it like this…

static void copyFromToTable(Args _args)
{
table1 table1;
table2 table2;
;

while select table2
{
table1.field1 = table2.field1 ;
table1.field2 = table2.field2;
table1.insert();
}

info(strfmt(“Mission Accomplished”));

}