Wednesday, 13 August 2014

Updating Table

Exportfile for AOT version 1.0 or later
Formatversion: 1
 // author: Kim Seng Chong
***Element: JOB

; Microsoft Dynamics AX Job: updatingTable unloaded
; --------------------------------------------------------------------------------
  JOBVERSION 1

  SOURCE #updatingTable
    #static void updatingTable(Args _args)
    #{
    #    CustTable       custTable;
    #    boolean         check = CustTable::checkExist('1005');
    #    ;
    #    //1st uopdating
    #    /*
    #    if (check)
    #    custTable   = CustTable::find('1005', true);
    #
    #    custTable.Currency = 'MYR';
    #    custTable.update();
    #
    #    info(custTable.name());
    #    info(custTable.Currency);
    #    */
    #    //2nd updaing
    #    /*
    #    ttsBegin;
    #    select forUpdate custTable
    #        where custTable.AccountNum == '1005';
    #
    #    custTable.Currency = 'MYR';
    #    custTable.update();
    #    ttsCommit;
    #    */
    #    //3rd updating
    #    ttsBegin;
    #    while  select forUpdate custTable
    #        where custTable.CustGroup == 'For'
    #    {
    #        if (custTable.Currency == 'USD')
    #        {
    #            info(strFmt('%1 %2 %3', custTable.CustGroup, custTable.name(), custTable.Currency));
    #            custTable.Currency = 'MYR';
    #            custTable.update();
    #        }
    #    }
    #    ttsCommit;
    #}
  ENDSOURCE
  PROPERTIES
    Origin              #{36508A99-1929-49BE-99B3-ABA385CCB53D}
  ENDPROPERTIES


***Element: END

No comments:

Post a Comment