# GraphQL Variables (list)

**URL:** <https://discuss.dgraph.io/t/graphql-variables-list/6233>\
**Category:** Dgraph\
**Created:** [April 1, 2020, 11:02pm UTC](https://discuss.dgraph.io/t/graphql-variables-list/6233 "2020-04-01T23:02:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kesor](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/kesor/32/2495_2.png) [@kesor](https://discuss.dgraph.io/u/kesor)\
**Post date:** [April 1, 2020, 11:02pm UTC](https://discuss.dgraph.io/t/graphql-variables-list/6233/1 "2020-04-01T23:02:44Z")

</div>

I am trying to figure out if DGraph supports a way to pass in a list of UIDs via the GraphQL Variables API call.

Examples:

This unfortunately does **not** work -

```auto
query GetStuff($uids: string = "0xa105,0xa11d,0xa101") {
  operators(func:type("Thing"))
  @filter(uid($uids))
  { uid name }
}

```

This does work, but it doesn’t use variables:

```auto
query GetStuff {
  operators(func:type("Thing"))
  @filter(uid("0xa105","0xa11d","0xa101"))
  { uid name }
}

```

This also works, although the uids are not even strings here.

```auto
query GetStuff {
  operators(func:type("Thing"))
  @filter(uid(0xa105,0xa11d,0xa101))
  { uid name }
}

```

Any other alternatives that I can use? Or is there no escape other than building the big query string in my code and not using variables at all?

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [April 2, 2020, 12:07am UTC](https://discuss.dgraph.io/t/graphql-variables-list/6233/2 "2020-04-02T00:07:46Z")

</div>

That feels like an enhancement, please fill up an issue.

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [April 2, 2020, 12:20am UTC](https://discuss.dgraph.io/t/graphql-variables-list/6233/3 "2020-04-02T00:20:33Z")

</div>

Actually, nevermind, I’ve just remembered about this PR [Support for Gql variable in arrays by srfrog · Pull Request #2981 · dgraph-io/dgraph · GitHub](https://github.com/dgraph-io/dgraph/pull/2981) and I thought about testing the hypothesis on this issue. And it worked.

```auto
query GetStuff($uids: string = "[0x1,0x2,0xa101]") {
  operators(func: uid($uids)) {    
     uid    
     name
    }
}

```

## Result

```auto
{
  "data": {
    "operators": [
      {
        "uid": "0x1"
      },
      {
        "uid": "0x2"
      },
      {
        "uid": "0xa101"
      }
    ]
  }
}

```

---

<div class="post-metadata">

**Author:** ![kesor](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/kesor/32/2495_2.png) [@kesor](https://discuss.dgraph.io/u/kesor)\
**Post date:** [April 2, 2020, 8:12am UTC](https://discuss.dgraph.io/t/graphql-variables-list/6233/4 "2020-04-02T08:12:07Z")

</div>

Excellent! Thank you very much.
