General X++ Development
How do I use a temporary table in X++?
How do I use a temporary table in X++?
1 answer
Write an answerPopulate a temp table buffer the same basic way you populate a normal table buffer.
MyTempTable.clear();
MyTempTable.ItemId = 'A0001';
MyTempTable.Qty = 10;
MyTempTable.insert();The part that usually matters is how the temp-table instance is shared.
For TempDB, use linkPhysicalTableInstance() when another buffer needs to point to the same physical temp table.
For InMemory, setTmpData() is commonly used when another buffer needs the same temporary dataset.
If two callers accidentally use different temp instances, the code can look completely correct while one side sees zero rows.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer