Skip to content
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:


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}}")
_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}}")</td>


_regex Regular expression
filter("{productCategory: {_regex:'[a-z]'}}")
_atLeast Minimum number of lines
_atMost Maximum number of lines
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'}}}}")
Not on condition
query (filter:"{id:{ _not: {_regex: 'FCR.*'}}}")