Cannot group filter with or operator
imhotepjs opened this issue · 1 comments
imhotepjs commented
Request
"filter": {
or: [{
PropName: { gt: 5 },
and: [
{ SomeProp: 1 },
{ AnotherProp: 2 }
]
}
Expected
$filter=((PropName gt 5 or ((SomeProp eq 1) and (AnotherProp eq 2))))
Response
$filter=((PropName gt 5 and ((SomeProp eq 1) and (AnotherProp eq 2))))
techniq commented
Each object/item in the array is or
'd together, so instead of:
{
filter: {
or: [{
PropName: { gt: 5 },
and: [
{ SomeProp: 1 },
{ AnotherProp: 2 }
]
}]
}
}
the { PropName: { gt: 5 } }
should be in a different object than the { and: [ ... ] }
like so:
{
filter: {
or: [
{ PropName: { gt: 5 } },
{ and: [
{ SomeProp: 1 },
{ AnotherProp: 2 }
]
}]
}
}
You can paste this into my odata-query sandbox if you need to test our the result of some queries. See also some of the tests (like this one). Hope that helps.