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;

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: AOT View Ranges: 'OR' operator in Value

    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

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: AOT View Ranges: 'OR' operator in Value

    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

  • Sergei Minozhenko Profile Picture
    23,091 on at
    RE: AOT View Ranges: 'OR' operator in Value

    Hi DAXDev,

    You can check if example from docs  working.

    A..D, !C

    Finds A, B, and D.

  • DAX Dev Profile Picture
    on at
    RE: AOT View Ranges: 'OR' operator in Value

    Hi Gunjan,

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

    So I will add ReferenceCategory twice in Ranges

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: AOT View Ranges: 'OR' operator in Value

    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
    RE: AOT View Ranges: 'OR' operator in Value

    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?

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,091 on at
    RE: AOT View Ranges: 'OR' operator in Value

    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

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: AOT View Ranges: 'OR' operator in Value

    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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

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... 292,997 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,831 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans