Expressions

An expression in your query string corresponds to what you would typically include in a WHERE clause of a typical SQL query. It comprises a set of conditions, logical operators, and groups. A condition consists of an identifier, a comparison operator, and a value (or identifier of another field). Logical operators like AND and OR can be used to combine conditions, and you can use parentheses to establish conditional groups and enforce order of precedence.

For example, to retrieve all objects with ID 1, 2, or 3, or all objects with the name "test" and having a contact whose name starts with "bouw", you can perform the following query:

id IN (1, 2, 3) OR (name = "test" AND contact.name LIKE "bouw%")

Parentheses behave as expected in any SQL-like language, allowing you to control the grouping of conditions.

Identifiers

An identifier always appears on the left-hand side of a comparison and refers to a field within a schema. You can refer to the schema reference for a list of available schemas and the fields exposed by each of them.

Operators

The following comparison operators can be used in expressions:

Operator Description Example
=, is The condition is true if both operands have equal values, otherwise false. a = b
!=, is not The condition is true if both operands do not have equal values, otherwise false. a != b
> The condition is true if the value of the left operand is greater than that of the right operand, otherwise false. a > b
>= The condition is true if the value of the left operand is greater than or equal to the right operand, otherwise false. a >= b
< The condition is true if the value of the left operand is less than that of the right operand, otherwise false. a < b
<= The condition is true if the value of the left operand is less than or equal to the right operand, otherwise false. a <= b
IN The condition is true if the value of the left operand exists in the list provided as the right operand, otherwise false. a IN (1, 2, 3)
NOT IN The condition is true if the value of the left operand does not exist in the list provided as the right operand, otherwise false. a NOT IN (1, 2, 3)
LIKE The condition is true if the value of the left operand matches the right operand, which supports wildcard matching using percent signs on either the utmost left or utmost right side of the operand. a LIKE "%Henk" OR a LIKE "Henk%"

Null Values

The null value may also be written as empty to allow for a more natural way of expressing whether a collection is or is not empty.

For example, to fetch a list of objects that has at least one "employee" associated with it, you can use the following query, presuming that the "employees" field is a collection:

?q=employees is not empty

This is equivalent to the following expressions:

?q=employees.id is not null

# or...
?q=employees.id != null