Skip to main content

Notifications

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 22

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

  • it.dev Profile Picture
    22 on at
    RE: How to filter Odata with multiple enum value D365

    Hi All,

    Finally the filter works after i synchronize the db, i dont't know if that relates to this issue but hopefully the filter run already with OR like this <MyUrl>/data/RateTypeEntity?cross-company=true&$filter=Type eq Microsoft.Dynamics.DataEntities.RateType'OC' or Type eq Microsoft.Dynamics.DataEntities.RateType'C'

    Thanks,

    Masha

  • it.dev Profile Picture
    22 on at
    RE: How to filter Odata with multiple enum value D365

    Hi Uday,

    I already used the enum name

    Thanks,

    Masha

  • udaY-ch Profile Picture
    4,643 on at
    RE: How to filter Odata with multiple enum value D365

    Hi,

    Try using enumValueName than enum value label.

    Uday

  • it.dev Profile Picture
    22 on at
    RE: How to filter Odata with multiple enum value D365

    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

  • Suggested answer
    Deekshit Addepalli Profile Picture
    on at
    RE: How to filter Odata with multiple enum value D365

    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.

  • Sergei Minozhenko Profile Picture
    23,091 on at
    RE: How to filter Odata with multiple enum value D365

    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'

  • it.dev Profile Picture
    22 on at
    RE: How to filter Odata with multiple enum value D365

    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,091 on at
    RE: How to filter Odata with multiple enum value D365

    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
    22 on at
    RE: How to filter Odata with multiple enum value D365

    Hi Sergei,

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

    Thanks

    Masha

  • Sergei Minozhenko Profile Picture
    23,091 on at
    RE: How to filter Odata with multiple enum value D365

    Hi Masha,

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

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,110 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans