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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Multiple records printing

(0) ShareShare
ReportReport
Posted on by 45

Hi all,

I'm quite new to the ax. The situation is like this.

I would like to print multiple official receipt . the current way is , they can only print line by line. but i would like to include all the records displayed and print it. The form is directly link to the report and the datasource is by query which i dont really know how to use it.

i managed to get the selected records in the clicked method in the form, but when it comes to the report, it loops the same records although the count of the loops is correct. So my problem is, how to make the query run into the next record?

Attach is the code.  thanks !

Form:

void clicked()
{
LedgerJournalTrans ledgerJournalTranstbl;
;

ledgerJournalTrans = ledgerJournalTrans_ds.getFirst(true);

while (ledgerJournalTrans)
{


info(strfmt(" %1 | %2 | %3", ledgerJournalTrans.AccountNum,
ledgerJournalTrans.MarkedInvoice,
ledgerJournalTrans.JournalNum));
super();
ledgerJournalTrans = ledgerJournalTrans_ds.getNext();

}

}

Report:

public void init()
{
element.initFromArgs(element.args());
info(ledgerJournalTrans.MarkedInvoice);
element.initializeQuery();
super();
monthMap = new Map(Types::String, Types::Real);
}

void initFromArgs(Args args)
{

if (args && args.dataset())
{
switch(args.dataset())
{
case tablenum(LedgerJournalTrans) :
ledgerJournalTrans = args.record();
break;

case tablenum(LedgerJournalTable) :
ledgerJournalTable = args.record();
break;

}

}
}

public void initializeQuery()
{
QueryBuildRange rangeJournalNum;
QueryBuildRange rangeVoucher;
QueryBuildRange rangeAccountType;
;

query = element.query();


if (ledgerJournalTrans)
{
rangeJournalNum = query.dataSourceTable(tablenum(LedgerJournalTrans)).findRange(fieldnum(LedgerJournalTrans,JournalNum));
rangeVoucher = query.dataSourceTable(tablenum(LedgerJournalTrans)).findRange(fieldnum(LedgerJournalTrans,Voucher));
rangeAccountType = query.dataSourceTable(tablenum(LedgerJournalTrans)).findRange(fieldnum(LedgerJournalTrans,AccountType));

if (!rangeJournalNum)
rangeJournalNum = query.dataSourceTable(tablenum(LedgerJournalTrans)).addRange(fieldnum(LedgerJournalTrans,JournalNum));

if (!rangeVoucher)
rangeVoucher = query.dataSourceTable(tablenum(LedgerJournalTrans)).addRange(fieldnum(LedgerJournalTrans,Voucher));

if (!rangeAccountType)
rangeAccountType = query.dataSourceTable(tablenum(LedgerJournalTrans)).addRange(fieldnum(LedgerJournalTrans,AccountType));

rangeJournalNum.value(QueryValue(LedgerJournalTrans.JournalNum));
rangeVoucher.value(QueryValue(LedgerJournalTrans.Voucher));
rangeAccountType.value(QueryValue(LedgerJournalACType::Cust));

}

}

boolean fetch()
{
;

queryRun = new QueryRun(this);

while (queryRun.next())
{
ledgerJournalTrans = queryRun.get(tablenum(LedgerJournalTrans));

element.buildSettleAmountList();

element.send(ledgerJournalTrans);

/*
mapEnumerator = new MapEnumerator(monthMap);

while (mapEnumerator.moveNext())
{
info(strfmt("%1 -- %2", mapEnumerator.currentKey(), mapEnumerator.currentValue()));
}
*/
}

return true;
}

*This post is locked for comments

I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans