Blog

Name is Anant Dubey and the intent to create this blog is to discuss the problems and issues that developer face in the dynamics AX development and to share the new things that come up with the new version of AX.

Thursday, May 2, 2019

Clear multiple open statements using X++ in ax 2012

static void ClearStatement(Args _args)
{
    RetailStatementTable    statementTable;

    while select forUpdate statementTable
        order by calculatedDate desc
            where (statementTable.storeId == '092')
                //&& statementTable.statementId > '091-000311'//mkDate(20,12,2018)
    {
        statementTable.unmarkTransactions();
        statementTable.unmarkPosBatches();

        ttsBegin;
        statementTable.recalculate = NoYes::No;
        statementTable.calculatedDate = dateNull();
        statementTable.CalculatedLines = 0;
        statementTable.calculatedTime = 0;
        //statementTable.stmtCalcInfoLog = "";
        //statementTable.stmtPostInfoLog = "";

        statementTable.doUpdate();
        ttsCommit;
    }
    info("Done");
}