In OData V4, you are able to filter out empty strings as follows:
OData/v4/2.0/Case?filter=Date ne null
or OData/v4/2.0/Case?filter=Date ne ''
I, however, have an OData query which requires filtering out an empty array/list of names (empty would be: [] so an empty list). Lists cannot be filtered out in the same way:
OData/v4/2.0/Case?filter=Names ne null
does not work. Same goes for the other method.
Is there another way to filter out lists like this Names one?
Thanks in advance
...Or you can use any() operator.
The any operator without an argument returns true if the collection is not empty.
docs
OData/v4/2.0/Case?$filter=Names/any()
If your service supports this operation, you can use the $it
literal:
OData/v4/2.0/Case?filter=$it/Names/$count gt 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With