web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to make a query to retrieve invoice and use it in a report

(0) ShareShare
ReportReport
Posted on by 202

Hi, Everyone

please help me, i need to join tmpCustVendTrans with LedgerJournalTrans/DimensionAttributeValueCombination, so that i can make a report like this

6165.Invoice.PNG

i retrieve the invoice number from tmpCustVendTrans, group it, and use it as a header.

and i put all data in one temporary table.

Here's My Query :

LedgerJournalTrans ljtr;
DimensionAttributeValueCombination dimensionAttributeValueCombination;
LedgerJournalId ledgerJournalId = '000001';
TmpBankReceiptVoucher tmpBankReceiptVoucher; // Temporary Table

while select ljtr where ljtr.JournalNum == ledgerJournalId //JournalNum Parameter { tmpCustVendTrans = this.tmpCustVendTrans(ljtr.JournalNum, ljtr.Voucher); while select dimensionAttributeValueCombination join ledgerJournalTable join ledgerJournalTrans where ledgerJournalTrans.JournalNum == ledgerJournalId && ledgerJournalTable.JournalNum == ledgerJournalId && ( dimensionAttributeValueCombination.RecId == ledgerJournalTrans.LedgerDimension || dimensionAttributeValueCombination.RecId == ledgerJournalTrans.OffsetLedgerDimension ) { tmpBankReceiptVoucher.LedgerJournalId = ledgerJournalTrans.JournalNum; tmpBankReceiptVoucher.LedgerJournalName = ledgerJournalTable.Name; tmpBankReceiptVoucher.TransDate = ledgerJournalTrans.TransDate; tmpBankReceiptVoucher.LedgerDimension = dimensionAttributeValueCombination.RecId; while select tmpCustVendTrans { tmpBankReceiptVoucher.InvoiceId = tmpCustVendTrans.Invoice; } tmpBankReceiptVoucher.insert(); } }

the problem is, when i pull the data, i got redundant data. the OffsetLedgerDimension is repeated every row.

thanks for helping me

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Amir Nazim Profile Picture
    5,994 on at

    are you looking for payment information of the invoice or you want to print accounting distribution of the invoice. Your problem statement is not clear please explain more.

  • Chaidir Ali Assegaf Profile Picture
    202 on at

    Nevermind, i already found the answer, thank's for the response. here what i do to make my query work like i expected.

    i removed the join in the inner loop that fetch data from dimensionAttributeValueCombination with ledgerJournalTrans. because, the outer loop already fetch that data.

    LedgerJournalTrans ljtr;
    DimensionAttributeValueCombination dimensionAttributeValueCombination;
    LedgerJournalId ledgerJournalId = '000001';
    TmpBankReceiptVoucher tmpBankReceiptVoucher; // Temporary Table

    while select ljtr where ljtr.JournalNum == ledgerJournalId //JournalNum Parameter { tmpCustVendTrans = this.tmpCustVendTrans(ljtr.JournalNum, ljtr.Voucher); while select dimensionAttributeValueCombination join ledgerJournalTable && ledgerJournalTable.JournalNum == ledgerJournalId && ( dimensionAttributeValueCombination.RecId == ledgerJournalTrans.LedgerDimension || dimensionAttributeValueCombination.RecId == ledgerJournalTrans.OffsetLedgerDimension ) { tmpBankReceiptVoucher.LedgerJournalId = ljtr.JournalNum; tmpBankReceiptVoucher.LedgerJournalName = ledgerJournalTable.Name; tmpBankReceiptVoucher.TransDate = ljtr.TransDate; tmpBankReceiptVoucher.LedgerDimension = dimensionAttributeValueCombination.RecId; while select tmpCustVendTrans { tmpBankReceiptVoucher.InvoiceId = tmpCustVendTrans.Invoice; } tmpBankReceiptVoucher.insert(); } }
  • Wasam Gohar Profile Picture
    50 on at

    Hi Bro Can You Help Me Out To find  tmpCustVendTrans Relation Have to Find the Voucher Number from this Table.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans