//Copying data of one table to another table across the company in AX2009
static void CopyDataFromOneTableToAnother(Args _args)
{
TableA tableA;
TableB tableB;
DataArea dataArea;
;
while select dataArea
{
changeCompany(dataArea.id)
{
tableA= null;
tableB= null;
while select tableA
{
tableB.CustAccount = tableA.CustAccount;
tableB.ItemCode = tableA.ItemCode;
tableB.insert();
}
}
}
info(strfmt("Mission Accomplished"));
}
static void CopyDataFromOneTableToAnother(Args _args)
{
TableA tableA;
TableB tableB;
DataArea dataArea;
;
while select dataArea
{
changeCompany(dataArea.id)
{
tableA= null;
tableB= null;
while select tableA
{
tableB.CustAccount = tableA.CustAccount;
tableB.ItemCode = tableA.ItemCode;
tableB.insert();
}
}
}
info(strfmt("Mission Accomplished"));
}
Just make sure to assign a null to the table buffer variable you will insert inside your changecompany statement:
ReplyDeleteInventTable itFrom;
InventTable itTo;
itFrom = InventTable::Find("OL-1000");
changeCompany("OTH")
{
itTo = null;
buf2buf(itFrom, itTo);
itTo.insert();
}
newTable.data(originalTable)
ReplyDeleteI suspect there is a performance benefit to the .data() method as it is more commonly used in standard AX.
http://dynamicsuser.net/forums/p/20394/93643.aspx
ReplyDelete