Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Adding Or Condition in...
Finance forum
Suggested answer

Adding Or Condition in AOT Query Range

editSubscribe (1) ShareShare
ReportReport
Posted on by 15
 
 
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
  • Layan Jwei Profile Picture
    Layan Jwei 3,079 Super User 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
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 3,079 Super User 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
     
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 4,311 User Group Leader 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
  • Layan Jwei Profile Picture
    Layan Jwei 3,079 Super User 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

Helpful resources

Quick Links

Take the Community feedback survey!

Answer this brief 15-question survey about your Community experience…

Demystifying Copilot: Service Edition with Sundar Raghavan

Sundar answers more questions about Copilot for Service...

Dynamics 365 Business Central vs Finance and SCM

Take a look at the key differences between Business Central and…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,375 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,308 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans