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)

QUerystr returning blanks records too

(0) ShareShare
ReportReport
Posted on by 439

I have created a aot query as DeliveryNotegroup which consists one table and I have selected 

querystr.png

static void Job203(Args _args)
{
Query q = new Query(queryStr (DeliveryNotegroup));
;

QueryRun qr;
QueryBuildDataSource qbd;
SON_AttachmentELMOInvoice SON_AttachmentELMOInvoice;
QueryBuildRange qbr;

qbd = q.addDataSource(TableNum(SON_AttachmentELMOInvoice));
qbr = qbd.addRange(FieldNum(SON_AttachmentELMOInvoice, SummaryInvoiceNumber));
qbr.value(("17620191"));
qr = new QueryRun(q);

while(qr.next())
{
SON_AttachmentELMOInvoice = qr.get(tableNum(SON_AttachmentELMOInvoice));
info(strFmt("%1",SON_AttachmentELMOInvoice.RecId));
}
}

actually in the AOT query I have only one table  if the table has 70 records when i run the while(qr.next())  it returns 70 records with their rec id  and  70 blanks records  so the query run runs for 140 times for 70 records 

I find one thing  find that when  create the dynamics query with querybuild without aot query it returns correct value. only 70 records  and which is correct 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,959 Most Valuable Professional on at

    It seems that your intention was to add a range to the datasource defined in AOT, but that's not what your code does. You ignore the existing datasource and you create a new one (by addDataSource()) and you filter this new datasource.

    Use q.dataSourceTable() instead of q.addDataSource() to get the datasource defined in AOT.

  • rohit1900 Profile Picture
    439 on at

    thank you Martin issue resolved.

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