Skip to content
Developerhome
Sage Distribution and Manufacturing Operations

Examples of GraphQL operations: Queries with filters and counts

  Less than to read

Filtering syntaxes can have various forms and use several operators, such as:

</table>

The string constants are placed between single brackets.

The following pages describe different cases of GraphQL queries using filters and counts. The queries use real examples.

Here are some examples of filters:

Operator Signification Example
_eq Equals
filter("{productCategory: {_eq:'SFINI'}}")
_ne Not equal to
filter("{productCategory: {_ne:'SRAW'}}")
_gt Greater than
filter("{totalTaxAmount: {_gt:1000}}")</td>

</tr>

_gte Greater than or equal
filter("{totalTaxAmount:  {_gte:300.14}}")
_lt Less than
filter("{totalTaxAmount:  {_lt:12.34}}")
_lte Less than or equal to
filter("{totalTaxAmount:  {_lte:1414.21}}")
_regex Regular expression
filter("{productCategory: {_regex:'[a-z]'}}")
_atLeast Minimum number of lines
filter("{_atLeast:2,{quantity:{_lt:2}}}")
_atMost Maximum number of lines
filter("{_atMost:1,{quantity:5}}")
_every Every line
filter("itemSites:{_every:true,site:{name:{_regex:'H'}}}")
_none Not all lines
filter("{itemSites:{_none:true,site:{name:{_regex:'H'}}}}")
Simple value equality
query(filter: "{ minimumPrice: 45}")
Comparison operators (less than)
query(filter: "{minimumPrice:{_lt:45}}")
Combined filters (and)
query(filter: "{isActive:true,minimumPrice:{_lt:45}}")
Filter on nested properties (not equal)
query(filter: "{stockUnit:{name:{_ne:'each'}}}")
Combined filters (or)
query(filter: "{_or: [{isActive:true},{minimumPrice:{_lt:45}}]}")
List of values
query(filter: "{minimumPrice:{_in:[0,45,450]}}")
Regular expression
query(filter: "{stockUnit:{name:{_regex:'.*i.*'}}}")
Minimum number of lines in a secondary level
query (filter:"{customers: {_atLeast:1}}")
Minimum count on condition
query (filter:"{customers: {_atLeast:2,customer:{currency:{id:'EUR'}}}}")
Condition fulfilled in every line
query(filter: "{itemSites:{_every:true,site:{name:{_regex:'H'}}}}")
Condition not fulfilled in every line
query(filter: "{itemSites:{_none:true,site:{name:{_regex:'H'}}}}")
Not on condition
query (filter:"{id:{ _not: {_regex: 'FCR.*'}}}")