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, ...
Answered

How to filter Odata with multiple enum value D365

(0) ShareShare
ReportReport
Posted on by 28

Hi All,

How could i filter odata with multiple enum value? I tried using this filter on the postman and not success

$filter=Type eq Microsoft.Dynamics.DataEntities.RateType'OC' And Type eq Microsoft.Dynamics.DataEntities.RateType'C'

Thanks 

Masha

I have the same question (0)
  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Masha,

    You need to use 'OR' instead of 'AND' as enum field can't contain more than one value and 'AND' condition will always return false.

  • it.dev Profile Picture
    28 on at

    Hi Sergei,

    I tried it with or and still not success

    Thanks,

    Masha

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Masha,

    Do you get any data if you just filter by one of the enum value (without 'and' or 'or' condition)?

  • it.dev Profile Picture
    28 on at

    Hi Sergei,

    Yes i can get the data if filter only one of the enum

    Thanks

    Masha

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Masha,

    Could you, please, provide the full url you are using?

    At least for me 'or' condition is working fine, maybe you have other parameters in the url?

    <MyUrl>/data/SalesOrderHeadersV2?$filter=SalesOrderStatus eq Microsoft.Dynamics.DataEntities.SalesStatus'Backorder' or SalesOrderStatus eq Microsoft.Dynamics.DataEntities.SalesStatus'Canceled'

  • it.dev Profile Picture
    28 on at

    Hi Sergei,

    this is my url

    <MyUrl>/data/RateTypeEntity?$filter=Type eq Microsoft.Dynamics.DataEntities.RateType'OC' And Type eq Microsoft.Dynamics.DataEntities.RateType'C'

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Masha,

    But it's still using 'And' keyword.

    Try to use that example <MyUrl>/data/RateTypeEntity?cross-company=true&$filter=Type eq Microsoft.Dynamics.DataEntities.RateType'OC' or Type eq Microsoft.Dynamics.DataEntities.RateType'C'

  • Suggested answer
    Deekshit Addepalli Profile Picture
    on at

    If you want to return values corresponding to both enums, then you would use the binary "OR" which roughly translates to "AND" in english :)

    If you use AND in your expression (URL) then its looking to see if there is a match that satisfies RateType=OC and RateType=C for the same record.

  • it.dev Profile Picture
    28 on at

    Hi Sergei and Deekshit,

    Still not success either use AND / OR. Here's the error i got in the postman

    "Syntax error at position 90 in 'Type eq Microsoft.Dynamics.DataEntities.RateType'OC' OR Type eq Microsoft.Dynamics.DataEntities.RateType'C''."

    Thanks,

    Masha

  • udaY-ch Profile Picture
    5,128 on at

    Hi,

    Try using enumValueName than enum value label.

    Uday

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans