-->

Merge several dynamics AX reports in one

2019-02-21 05:54发布

问题:

I have the following problem: I want to merge salesInvoice reports in 1 report containing all invoices.

I'm using a job that prints reports with printJobSettings, Args and reportRun classes. My parm is a ledgerJournal num and I want to print all relative invoices in one report not printing each invoice separately.

How can I do to generate only one report?

Basically, I take my JournalNum from LedgerJournalTrans Table, I loop on CustInvoiceJour table to have all relative invoices and execute report, I think I should override fetch method to do this, but fetch method on salesInvoice report is quiet heavy and I don't want to loose information.

回答1:

You can call the printJournal method of the CustInvoiceJour table. As the second argument give it a RecordSortedList of the invoices you want to print.

You will also need a SalesFormLetter object as the first argument, populated with relevant printJobSettings.

You will most likely have to change the fetch method as the element.reset() call finalizes the report as a print job. This no good if the output is going to a PDF or mail.

Most likely you can change element.reset to:

element.newPage();
element.page(1);

This will make a page break and reset the page counter. One caveat: pageTotal method will not be reset, so "Page 1 of 7" will not work.