Announcements
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 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
Hi Uday,
I already used the enum name
Thanks,
Masha
Hi,
Try using enumValueName than enum value label.
Uday
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
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 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'
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'
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'
Hi Sergei,
Yes i can get the data if filter only one of the enum
Thanks
Masha
Hi Masha,
Do you get any data if you just filter by one of the enum value (without 'and' or 'or' condition)?
André Arnaud de Cal...
294,110
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator