Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Execute Query Adding two Ranges to same Queryrange

Posted on by


qbr = this.query().dataSourceNo(1).addrange(fieldNum(SalesTable, SalesStatus));
qbr.value(queryValue((SalesStatus::Backorder)));

qbr = this.query().dataSourceNo(1).addrange(fieldNum(SalesTable, DeliveryDate));
qbr.value(DateFilter.valueStr());

super();

This code doesn't seem to filter open order for a specific date. Please help.

*This post is locked for comments

  • Martin Dráb Profile Picture
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: Execute Query Adding two Ranges to same Queryrange

    I'm not sure what you want to see instead. What you're doing is indeed building a SQL query that will be sent to database, therefore the debugger offers you a way to review whether you've really built what you intended.

  • NoobDaxCoder Profile Picture
    NoobDaxCoder on at
    RE: Execute Query Adding two Ranges to same Queryrange

    It is  a custom form. Datevalue() method solved the problem. I am learning Dynamics ax, in training.

    How to debug A query using debugger. For example, for a str, date variable i can see value being passed on to a variable. On other hand, for query, whatever is writern is transformed to select statement.. I am beginner Martin, any guidance will be greatly appreciated and I will be thankful for your help.

    querydebugger.png

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: Execute Query Adding two Ranges to same Queryrange

    In which form?

    Also you still didn't mention any debugging. First of all, open personalization of your form, switch to the Query tab and review whether your ranges are there.

    I think you'll see them, but with invalid value of the DeliveryDate range, because you're setting it wrong. Use qbr.value(queryValue(DateFilter.dateValue()) instead of qbr.value(DateFilter.valueStr()).

  • NoobDaxCoder Profile Picture
    NoobDaxCoder on at
    RE: Execute Query Adding two Ranges to same Queryrange

    SalesTable_ds.ExecuteQuery. I wrote this code in SalesTable datasource execute query. SalesTable is in 1st position.

  • Martin Dráb Profile Picture
    Martin Dráb 230,188 Most Valuable Professional on at
    RE: Execute Query Adding two Ranges to same Queryrange

    Unfortunately we can't help you, because you didn't gave us any context. First of all, tell us where you're using your code, because it may be at a wrong place.

    Then tell us how you debugged it before giving it up and coming here.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans