I am trying to use ODATA with a filter that will only show data if a,b and c are all not equal to 0.
What I am trying to say is this:
#Data i want to get
a=1
b=0
c=0
#Also data i want to get
a=1
b=1
c=0
#Data i do not want to get
a=0
b=0
c=0
I tried doing ?$filter=a ne 0 and b ne 0 and c ne 0
, but that only gets me data where all values must be not 0. i.e. a=1,b=1,c=1
What i'm trying to say is: How can I filter to exclude data if only all values are 0?
I am trying to filter before processing in code because this will save me on average 9 seconds per-request.
One option can be using not
operator.
You don't want to return data where all a
, b
and c
are equal to 0
.
?$filter=not(a eq 0 and b eq 0 and c eq 0)
If not
is not supported then alternative to not(a eq 0 and b eq 0 and c eq 0)
is
?$filter=a ne 0 or b ne 0 or c ne 0
After clarification that the service is dynamics 365. It's not possible to use OR operator in filter for two different properties