Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : lh2SLaR4yu2R+CrQvYzhUK
Finance | Project Operations, Human Resources, ...
Answered

AOT query with OR ranges

Like (0) ShareShare
ReportReport
Posted on 30 Jun 2020 19:57:33 by 6,603

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!

  • Martin Dráb Profile Picture
    232,093 Most Valuable Professional on 02 Jul 2020 at 09:49:10
    RE: AOT query with OR ranges

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

  • bankk Profile Picture
    6,603 on 01 Jul 2020 at 21:10:52
    RE: AOT query with OR ranges

    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.

  • Suggested answer
    Vishal Dhavgaye Profile Picture
    405 on 01 Jul 2020 at 16:30:01
    RE: AOT query with OR ranges

    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,603 on 01 Jul 2020 at 14:40:24
    RE: AOT query with OR ranges

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

  • Blue Wang Profile Picture
    on 01 Jul 2020 at 01:10:40
    RE: AOT query with OR ranges

    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,603 on 30 Jun 2020 at 23:34:11
    RE: AOT query with OR ranges

    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?

  • Verified answer
    Martin Dráb Profile Picture
    232,093 Most Valuable Professional on 30 Jun 2020 at 20:15:00
    RE: AOT query with OR ranges

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,296 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,093 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans
Loading started
Loading complete