How to compare values using ArcQL

In the previous post, we have seen how to retrieve all the records using Match All query
Now we will check how to compare values using comparison queries.

  • Comparison Operators like < , >, <=,>=, ! compare the content in the fields to constant values
  • They work with integers, strings, and floats
  • Boolean logic is also possible to get desired results.

Frame a query like this:

a < 20
a > 'S'
a <= 10 AND a >=30
a != 10

We will work with the same schema used earlier.

type arcqlObject {
    str: String
    int: Int
}

Sample Query

Let’s search the values in the int field greater than or equal to 2

{
  find(type: arcqlObject, arcql: "int >= 2") {
    edges {
      node {
        ... on arcqlObject {
          str
          int
          hypi {
            id
          }
        }
      }
      cursor
    }
  }
}
#result
{
  "data": {
    "find": {
      "edges": [
        {
          "node": {
            "str": "low code",
            "int": 2,
            "hypi": {
              "id": "01FJGS5P4DBC3HVS5EESRD63ZY"
            }
          },
          "cursor": "01FJGS5P4DBC3HVS5EESRD63ZY"
        }
      ]
    }
  }
}

Check the POSTMAN collection for the comparison query in different programming languages! Click </> and choose the programming language of your choice.

Don’t forget to insert your own Authorization key and Hypi Domain under Headers to test the results!
Run in Postman