ranic
(Tina Ranic)
February 6, 2019, 10:29am
1
Hi,
I need to be able to filter on an arbitrary number of values for a given predicate (which can be either string type or [string]). However currently, I don’t see an option apart from defining a separate query depending on the number of arguments, which is silly.
I saw a similar request this time last year (query variable value as array), any improvements?
Thanks!
MichelDiz
(Michel Diz)
February 6, 2019, 1:19pm
2
Did you mean “GraphQL variables”? (which are DQL Variables in fact)
If so, there’s a small update about it
opened 08:11PM - 27 Mar 18 UTC
kind/bug
If you suspect this could be a bug, follow the template.
- What version of Dgra… ph are you using?
1.0.4
- Steps to reproduce the issue (command/config used to run Dgraph).
```
query all($a: string, $b: string) {
all(func: eq(whatever, [$a, $b])) {
uid,
}
}
```
> Expected comma or language but got: a
- Expected behaviour and actual result.
Either I'm doing something wrong or GraphQL variables that are used in arrays don't work. And since it's not possible to define variable as arrays, it also seems impossible to do something like:
```
query all($a: [string]) {
all(func: eq(whatever, $a)) {
uid,
}
}
```
If not, can you be more specific?
Cheers.
nunucheong
(Cheong Chah Wei)
May 28, 2021, 2:52am
3
I think @ranic was referring to this: Support lists in query variables (Dgraph's GraphQL Variable) · Issue #2726 · dgraph-io/dgraph · GitHub
The request is well captured in this reply .
Keen to know if there’s any improvement in this regard.