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 :
Finance | Project Operations, Human Resources, ...
Answered

AOT query with OR ranges

(0) ShareShare
ReportReport
Posted on by 6,611

Hello:

I have an AOT query which has a datasource node pointed to InventTrans. I'd like to add a Ranges conditional where StatusIssue = 1 OR StatusReceipt = 1. I assume adding two Ranges with each pointed to a specific field and value would equate to an AND. Thank you!

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

    It can be done by Using Expressions in Query Ranges.

    Alternatively you could use a union query (combining one selection for StatusIssue and one for StatusReceipt), or you could create a view with a computed column (combining StatusIssue and StatusReceipt) and filtering by this computed column.

  • bankk Profile Picture
    6,611 on at

    Just to clarify, so if I add a Ranges node to my AOT query, I can then simply add an expression such as

    ((StatusIssue == 1) || (StatusReceipt == 1))

    So regardless of which of the two fields I choose in the Field property, I can still reference the other?

  • Blue Wang Profile Picture
    Microsoft Employee on at

    Hi Ichiban,

    Your confusion is similar to this thread, you can look at Martin's detailed explanation.

    community.dynamics.com/.../addrange-with-and-and-or-conditions

    www.axaptapedia.com/Expressions_in_query_ranges

  • bankk Profile Picture
    6,611 on at

    I'm not sure I understand. My issue is with an AOT query; I'm not building X++ code.

  • Suggested answer
    Vishal Dhavgaye Profile Picture
    405 on at

    Hi Ichiban,

    Where you using this query?

    Wherever you using this AOT query, you can apply ranges by getting query.

    Query q = new Query(queryStr('AOTQueryName'));

    As explained above you can then apply complex ranges using Expression, but yours look simple 

    Please check,

    https://docs.microsoft.com/en-us/dynamicsax-2012/developer/using-expressions-in-query-ranges?wt.mc_id=5000414 

  • bankk Profile Picture
    6,611 on at

    The query is actually already wrapped in a View. The view is called from X++ code. I'm hoping to just add the Range to the query, but worst case, I can filter it out after calling the view, but probably not best approach to limit records returned.

  • Martin Dráb Profile Picture
    239,036 Most Valuable Professional on at

    Isn't an union query the best solution in your case?

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 468 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans