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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

AOT View Ranges: 'OR' operator in Value

(0) ShareShare
ReportReport
Posted on by

Hello,

I have a simple aot view created. The datasource is InventTrans.

I want to filter it with StatusIssue enum field.

If I have StatusIssue field in Ranges and I type StatusIssue::Sold, the values are filtered correctly.

Now I wanted to add another filter, so I have type StatusIssue::Sold || StatusIssue::Deducted. In this case it does not show anything at all, the view is empty.

How can I do that?

So, actually this what I want to have in View:

select * from InventTrans
    where   InventTrans.StatusIssue == StatusIssue::Sold ||
            InventTrans.StatusIssue == StatusIssue::Deducted;

I have the same question (0)
  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi DaxDev,

    Have you tried specifying the range value like this - Sold,Deducted ?

    You don't need to mention the Enum name. You need the values only

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi DaxDev,

    You need to comma to separate value in "or" expression.

    Check docs

    docs.microsoft.com/.../how-to-create-queries-by-using-the-aot

  • DAX Dev Profile Picture
    on at

    Hi Sergei,

    Thanks,

    How should I do it if I want AND (&&) expression?

    For example if I add InventTransOrigin to InventTrans datasource and I want to filter it with

    !InventTransType::TransferOrderReceive && !InventTransType::TransferOrderShip

    Should I use comma also here?

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi DaxDev,

    In your case, an InventTrans record can have one StatusReceipt value. So, I am not sure how you will do an 'AND" join. An "AND" join can come into picture if you add another field into the query range.

    The "," operator will work for the values you are looking to retrieve.

  • DAX Dev Profile Picture
    on at

    Hi Gunjan,

    I mentioned InventTransOrigin. There I want to use 'AND' for the ReferenceCategory field.

    So I will add ReferenceCategory twice in Ranges

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi DAXDev,

    You can check if example from docs  working.

    A..D, !C

    Finds A, B, and D.

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi DaxDev,

    For InventTransOrigin, can a record have two values for the field InventTransType? You are essentially including InventTransOrigin records where the InventTransType value is not equal to TransferOrderReceive OR not equal to TransferOrderShip.

    You don't have an '&&" condition here. The query value should be "!TransferOrderReceive , !TransferOrderShip

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi DaxDev,

    As an example, you can check the query SalesTableListPageOpen which has a range on "ReturnStatus" field which can't be Canceled OR Created.

    pastedimage1601401648157v1.png

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 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans