开发者

add LedgerTrans.DocumentNum field to BankAccountStatment report

开发者 https://www.devze.com 2023-02-12 08:06 出处:网络
I want to add LedgerTrans.DocumentNum field to BankAccountStatment report BankAccountStatment report has a datasource \"BankAccou开发者_JS百科ntTable\"

I want to add LedgerTrans.DocumentNum field to BankAccountStatment report

BankAccountStatment report has a datasource "BankAccou开发者_JS百科ntTable"

How can I perfrom this?

Note: LedgerTrans.DocumentNum can be reached through BankAccoutTrans.AccountId = BankAccountTable.AccountId then LedgerTrans.voucher = BankAccountTrans.Voucher


You can try declaring LedgerTrans ledgerTrans; in classDeclaration and adding following code in the report's fetch method before calling element.send(bankAccountTrans):

select firstonly ledgerTrans
    where ledgerTrans.TransDate     == bankAccountTrans.TransDate
       && ledgerTrans.Voucher       == bankAccountTrans.Voucher
       && ledgerTrans.DocumentNum   != "";

After that you'd only need to add a new display field in the ReportDesign\AutoDesignSpecs\Body:_2 section with the following code:

//BP Deviation Documented
display DocumentNum documentNum()
{
    return ledgerTrans.DocumentNum;
}

I didn't try it but it should work. As an alternative you can declare ledgerTrans in the fetch method, add element.send(ledgerTrans) after selecting ledgerTrans, and add a standard String field in the section mentioned above, Table=LedgerTrans, DataField=DocumentNum. Then no display method is needed.

P.S. I assumed you're using AX 2009 but for other versions of AX the logic remains the same.


This is simple:

display DocumentNum documentNum()
{
     return (select firstonly DocumentNum from ledgerTrans
         where ledgerTrans.TransDate     == bankAccountTrans.TransDate
            && ledgerTrans.Voucher       == bankAccountTrans.Voucher
            && ledgerTrans.DocumentNum   != "").DocumentNum;
}

Drag the method to the desired print location.

0

精彩评论

暂无评论...
验证码 换一张
取 消