How do you perform operations on variables in GraphQL?

I am a traditional programmer new to GraphQL and I can't seem to find documentation on what I consider the basics, aka manipulating variables. Note: I am using GraphQL with Shopify(Admin API), through an app GraphiQL, so that my effect syntax and capabilities.

Here is a piece of hypo (& broken) code where I have two iterations of the same code block

  1. <>that tries to add two variables
  2. <>on that sum items in a list. The specific code in this lines are guesswork..

If anyone has suggestions on sources for example code or API docs beyond GraphQL site, I have been searching and nothing I have found addresses this type of functionality.

query fiveorTenOrders($n: Int = 5,$m: list =[5,5], $boo: Boolean = true) {
  FiveOrds: orders(first: $n) {
    edges @include(if: $boo) {
      node {
        ...ordrecs
      }
    }
  }
  #<<<HERE and as basic arithmetic>>> 
  TenOrds: orders(first: ($n+$n) {
    edges @skip(if: $boo) {
      node {
        ...ordrecs
        
  #<<<OR HERE ...as a sum of list>>> 
  TenOrds: orders(first: $m:SUM {
    edges @skip(if: $boo) {
      node {
        ...ordrecs      
      }
    }
  }
}

fragment ordrecs on Order {
  id
  name
  createdAt
  shippingAddress {
    id
    city
    provinceCode
    zip
  }
}


Read more here: https://stackoverflow.com/questions/64894982/how-do-you-perform-operations-on-variables-in-graphql

Content Attribution

This content was originally published by Andy Sitison at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: