Tejashree S
Tejashree S

Reputation: 311

Temporary table at runtime

Is it possible to set table as temporary table at run time in ax 2009?

Upvotes: 2

Views: 7153

Answers (1)

Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18051

You mark a record buffer as temporary using the setTmp method. Also remember to call the doInsert method instead of the insert method if you want to avoid the any other updates made in the insert method.

To have a second record buffer refer to the same temporary table use the setTmpData method.

This test job illustrates the use:

static void TmpTest(Args _args)
{
    CustTable custTable, custTable2;
    ;
    custTable.setTmp();
    custTable.AccountNum = "123Tmp";
    custTable.Name = "Temporary?";
    custTable.doInsert();

    custTable2.setTmp();
    custTable2.setTmpData(custTable);
    select custTable2 where custTable2.AccountNum == "123Tmp";
    info(custTable2.Name);
}

Upvotes: 3

Related Questions