Search This Blog

Thursday, April 20, 2017

AX2012 Flush recids

static void krishh_flushAllRecIds(Args _args)
{
    #AviFiles

    Dictionary              dictionary  =   new Dictionary();
    systemSequence          systemseq   =   new systemSequence();

    SysDictTable            dictTable;
 
    TableId                 tableId,LastTableId;
 
    SysOperationProgress    progress;
    container               fileContainer;

    int                     i;  
   
    setPrefix("Flush all RecIds");
 
    tableId = dictionary.tableNext(0);
    lastTableId = dictionary.tableCnt();
 
    progress = new SysOperationProgress();
    progress.updateInterval(1);
    progress.setAnimation(#AviStopwatch);
    progress.setTotal(LastTableId);

    progress.setText(strfmt("Flushing recIds"));

    ttsbegin;
    while (tableId)
    {
        progress.incCount();

        dictTable = new SysDictTable(tableId);

        setPrefix(dictTable.name());

        Systemseq.suspendRecIds(tableId);
        Systemseq.suspendTransIds(tableId);
        Systemseq.flushValues(tableId);
        Systemseq.removeRecIdSuspension(tableId);
        Systemseq.removeTransIdSuspension(tableId);

        //info(strFmt("Tables RecId Flushed (%1)", dictTable.name()));
     
        tableId = dictionary.tableNext(tableId);
    }

    ttscommit;
}

No comments:

Post a Comment

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.