Closed
Description
Hi,
I want to filter the data with multiple values with some operators or methods.
How Can I filter?
I tried the below one...but it throws error. Need a better documentation on filter, sorting etc with some sample queries.
query {
products(filter: "mediaCode.any[1,2,3]") {
items {
clientCode
mediaCode
}
}
}
Activity
lukemurray commentedon Dec 11, 2023
The syntax is for calling a method is with braces
()
- so it should bemediaCode.any([1,2,3])
.Having said that, the array style may not be supported currently. I will update https://entitygraphql.github.io/docs/field-extensions/filtering with examples of each call and fix any issues found along the way.
santhidhanuskodi23 commentedon Dec 11, 2023
Could you please give exact query?
I tried
query {
products(mediaCode.any([1,2,3])) {
items {
clientCode
mediaCode
}
}
}
lukemurray commentedon Dec 11, 2023
As I thought above, this is currently not possible. Currently the
any
method works like theEnumerable.Any
LINQ method. E.g.Basically translates into C#
I will look at adding support for above and update the docs too.
lukemurray commentedon Dec 17, 2023
I know it is longer but you can (assuming
mediaCode
is just anint
) write thisproducts(filter: "mediaCode == 1 || mediaCode= 2 || mediaCode == 3")
#334 - add `isAny([])` method to the filter expression language