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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Adding Or Condition in AOT Query Range

(2) ShareShare
ReportReport
Posted on by 41
 
 
Hi All,
Hope you are doing Well, Just a simple question,  How to add AOT query range with OR condition with 2 different fields?
 
Any sample code or example will be helpful..
 
Thanks
I have the same question (0)
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Adding Or Condition in AOT Query Range
    Hi,
     
    I don't think I understand what you are trying to achieve. Can you please rephrase it?
     
    Or if you could write an x++ code or sql scripts that returns your required result then maybe I can help you more
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,390 Super User 2025 Season 2 on at
    Adding Or Condition in AOT Query Range
    Hi,
     
    you must use || when you want to OR condition in query.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Adding Or Condition in AOT Query Range
    Hi,

    I assume you edited the question because now it's clearer.

    let's assume your AOT query has table1. And you want to filter on field1 or field2.

    what you need to do, is just add a range for one of those fields only. Let's say field1, then in the range value fill it with this: ((Field1 == "123") || (Field2 == "ABC"))   

    each range needs to be in parenthesis, and you can add more than one field in the range value even though you only added range for field1. 

    Try it and it will work

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
     
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Adding Or Condition in AOT Query Range
    Hi,

    Is your question answered, if yes then please verify the answers that helped


    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Adding Or Condition in AOT Query Range
    Hi,
     
    Please don't forget to verify the answers that helped.
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    Adding Or Condition in AOT Query Range
    This is one of the way 
     
     
    In other way, from where the AOT query is being called, there you can call addrange method and pass the ranges as values.

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

#1
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 563 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans