Sunday, May 19, 2013

Ambil teks dari LedgerJournalTrans

AX tidak bisa melakukan pemotongan karakter pada query nya. Misal:

select * from table
where substr(table.name,3,5) = '12345'

oleh karena itu harus dilakukan cara  sbb:



 
    LedgerTrans lt;
    LedgerJournalTrans ljt;
    Voucher vch;
    str 60 text;
    str 250 text2;
    ;
    vch ='GBV113-000903';

    select firstonly *
    from ljt
    where ljt.Voucher ==vch;

    while select *
    from lt
    where lt.Voucher ==vch
    {

        if(lt.AmountMST >0)
        {
            select firstonly *
            from ljt
            where ljt.Voucher == vch
            && ljt.AmountCurDebit == lt.AmountMST;
        }
        else
        {
            select firstonly *
            from ljt
            where ljt.Voucher == vch
            && ljt.AmountCurCredit == abs(lt.AmountMST);
        }

        text = ljt.txt;
        text2 = text;

        if( lt.Txt==text)
        {
            text2= ljt.Txt;
        }

        info(strfmt('%1 %2',lt.AmountMST,text2));
    }

No comments:

Post a Comment