Using value variables for offset

Mirror of: https://github.com/dgraph-io/dgraph/issues/2564

{

 var(func: eq(account, "100")){
   client{
       cid as uid  
   }
   msg as message_limit
 }
 messageCount(func: uid(cid)){
        count(messages)
   messages(orderdesc: timestamp, offset: val(msg)){
        uid
        payload
        timestamp
   }
 }
}

message_limit here is message_limit:int ..
The essential point is that I want to be able to set values in the database to use as limits application side. The above results in : strconv.ParseInt: parsing "msg": invalid syntax which seems inconsistent considering that variables can be used for ordering as suggested by the documentation.

Value variables currently cannot be used as an offset.

What you can do now on from the client libraries is use [GraphQL variables[(https://docs.dgraph.io/query-language/#graphql-variables) to insert client-side variables for the offset value.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.