Источник:
http://alexvoy.blogspot.com/2012/03/...stance-of.html
==============
This short code shows how to work with a temporary table without creating it in AOT.
X++:
// how to use temporary table
// method Init of the form
public void init()
{
WmpInventNutrition nut; // regular table in AOT
WmpInventNutrition tmp; // instead of creating in AOT a temporary table
// we can create a temporary instance of the preivous regular table
;
super();
// here we make it temporary;
// it will disappear from memory when loses the scope
// in other words, when we close the form
tmp.setTmp();
// simply selecting some of records from the regular table
while select nut
where nut.ItemId like '_wmp*'
{
// and putting them in the temporary one
tmp.data(nut);
tmp.doInsert();
}
// finally to show them on the form
// we set the form data source to the temporary table
wmpInventNutrition.setTmp();
wmpInventNutrition.setTmpData(tmp);
}
Alternatively, if you know exactly how the field match, it will be faster to use insert_recordset:
X++:
// simply selecting some of records from the regular table
tmp.skipDataMethods();
insert_recordSet tmp (itemid) select ItemId from nut where nut.ItemId like '_wmp*';
Источник:
http://alexvoy.blogspot.com/2012/03/...stance-of.html