Adding variable to GraphQL QUery

Hi all, I'm trying to create a paginated GraphQL query so I can step through each record set to help QA/Proof read some data we are storing in a GraphQL CMS (GraphCMS.com).

When I add the variable to the GraphQL query I am getting an error. I have tried several ways to do this.

{
  questions(first: 1, skip: $recordNumber) {
    questionId
    termAndTopic {
      term
    }
    answers {
      answerText
      correctAnswer
      rejoiner {
        markdown
      }
    }
    questionText {
      markdown
    }
    taskListItem {
      itemNumber
    }
    questionDifficulty
  }
}

How do you add a variable to a GraphQL query?

Hey David!

These docs should help ya!

https://docs.retool.com/docs/shopify-integration#server-side-pagination-with-the-shopify-graphql-api
Basically, the variable can point to the dynamic value surrounding by double curly braces.

After you add in some $input variables to the query it will show the variables section in the UI (we're working on cleaning up that experience, it is a bit confusing at the moment). Here's an example of my GraphQL running with variables for pagination:



I'm not able to add a variable for some reason.

Would something like this screenshot work for you? The variable can point to the dynamic value surrounding by double curly braces.

After you add in some $input variables to the query it will show the variables section in the UI (we're working on cleaning up that experience, it is a bit confusing at the moment). That would look something like this:

These docs also walk through GraphQL variables a little as well! https://docs.retool.com/docs/shopify-integration#server-side-pagination-with-the-shopify-graphql-api