GraphQL with boolean conditions

Hello,

it is possible to use boolean confitions (like where-clauses in SQL with the Operations “and”/ “or”) in GraphQL?
If yes: how to formulate this?

bets regards
Volkhard

Can you clarify your question? What are you trying to achieve with GraphQL?

Hello Nirinchev,

i would like to make queries like the SQL
select Id from Adresses WHERE Name=‘ABC’ AND Country=‘XYZ’

i didn´t found any informations that those questions are possible…

best regards
Volkhard

Did you check the docs for filtering: https://realm.io/docs/javascript/latest/#filtering?

Hello Nirinchev,
thanks for the hint - this is for Javascript.
But i´m looking for a GraphQL-syntax, which is also supported by Realm.
Do you have some hint for GraphQL?

best regards
Volkhard

The syntax is the same. From the docs: the query parameter is “a verbatim realm.js query that will be used to filter the returned dataset”. It states that the query language used to filter data in GraphQL is the same as the one used by the Javascript SDK.

Hello nirinchev,

thanks for this - but i´m not able to write such a query in syntax.
Can you give me a simple example in graphql (e.g. like mine) please?
This would be very helpful for me.

best regards

Volkhard

Can you give me the query you’re using for GraphQL? The filter itself would be something like 'Name = "ABC" AND Country = "XYZ"'.

Hello nirinchev,
thanks for your support and help! :slight_smile:
i want to find a GraphQL-Syntax for this SQL-Statement: select Id from Adresses WHERE Name=‘ABC’ AND Country=‘XYZ’
So i startet the following GraphQL: query {addresses {Id}}
But i don´t know where and how to put the filter sql-condition Name=‘ABC’ AND Country=‘XYZ’.

thanks for your help

Volkhard

Your GQL query should look like:

query {
  addresses(query: "Name = 'ABC' AND Country = 'XYZ'") {
    Id
  }
}

Hello nirinchev,

cool - this works :slight_smile:
thanks for your help!

best regards

Volkhard Vogeler