# Support value variables for paging params (offset, after, first)

**URL:** <https://discuss.dgraph.io/t/support-value-variables-for-paging-params-offset-after-first/8753>\
**Category:** Dgraph\
**Tags:** dgraph, kind:enhancement, popular, area:querylang, area:querylang:vars\
**Created:** [September 4, 2018, 11:33pm UTC](https://discuss.dgraph.io/t/support-value-variables-for-paging-params-offset-after-first/8753 "2018-09-04T23:33:06Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [May 23, 2019, 10:36pm UTC](https://discuss.dgraph.io/t/support-value-variables-for-paging-params-offset-after-first/8753/4 "2019-05-23T22:36:34Z")

</div>

[romshark](https://github.com/romshark) _commented_ :

I think I faced a similar problem working on my [dgraph tech-demo](https://github.com/romshark/dgraph_graphql_go). I’m trying to implement pagination and this is the query I assumed to work:

```auto
query PostsPage(
  $first: int = 4,
  $id: string = "ce9f834c2fd143e7a0994cd01564d990"
) {
  var(func: eq(Post.id, $id)) {
    p as uid
  }
  posts(
    func: has(Post.id),
    orderasc: Post.id,
    after: val(p),
    first: $first
  ) {
    uid
    Post.id
    Post.title
    Post.contents
  }
}

```

Unfortunately, it seems like I can’t use `p` as an argument for `after`:

```auto
": strconv.ParseUint: parsing \"p\": invalid syntax"

```

I suddenly need 2 roundtrips to get the job done:

- fetch the `uid` by `id`
- then fetch the page using the `uid`

This is obviously bad because it could have been done with just a single simple query.  
Please correct me if I’m wrong.

---

_[View the full topic](https://discuss.dgraph.io/t/support-value-variables-for-paging-params-offset-after-first/8753)._
