Notifications
Announcements
No record found.
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
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.
Hi Sergei,
I tried it with or and still not success
Thanks,
Do you get any data if you just filter by one of the enum value (without 'and' or 'or' condition)?
Yes i can get the data if filter only one of the enum
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'
this is my url
<MyUrl>/data/RateTypeEntity?$filter=Type eq Microsoft.Dynamics.DataEntities.RateType'OC' And Type eq Microsoft.Dynamics.DataEntities.RateType'C'
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'
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.
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''."
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 664 Most Valuable Professional
André Arnaud de Cal... 522 Super User 2025 Season 2
Sohaib Cheema 303 User Group Leader