Query language
Corteza implements an SQL-like syntax for querying and sorting records.
Querying
FIELD OPERATOR VALUE [AND|OR FIELD OPERATOR VALUE [...]]
For the following examples, let us assume that we have a module named test with the following fields:
-
quantityof typeNumber -
priceof typeNumber -
nameof typeString -
visibleof typeCheckbox
quantity = 0 or price = zero
visible AND name LIKE 'a%'
Comparison operators
- Equal
-
-
=
-
- Not equal
-
-
!= -
<>
-
- Less then
-
-
<
-
- Less or equal then
-
-
<=
-
- Greater then
-
-
>
-
- Greater or equal then
-
-
>=
-
- Matches pattern
-
-
LIKE
-
- Does not match the pattern
-
-
NOT LIKE
-
When matching patterns, use _ to represent a single character; use % to represent zero, one, or multiple characters.
Boolean operators
-
AND: truthy when left and right are truthy -
OR: truthy when left or right is truthy
Multi-value fields
Filters for multi-value fields look precisely the same as they would for regular fields.
-
Field name:
users, field type:user selector, multi value option checked. -
Field name:
selects, field type:Select / dropdown, multi value option checked.
|
The filter returns the records where either one of the multi-value values matches the current user. |
|
|
The filter returns the records where either one of the multi-value select options matches the |
|
|
The filter returns the records where either one of the multi-value select options equals |
Sorting
FIELD[ DIRECTION][, FIELD[ DIRECTION] [...]]
-
ASC: sort in ascending order, lower values first (NULLvalues are first). This is the default sort if noDIRECTIONis specified. -
DESC: sort in ascending order, lower values last (NULLvalues are last).
For the following examples, let us assume that we have a module named test with the following fields:
-
quantityof typeNumber -
priceof typeNumber -
nameof typeString -
visibleof typeCheckbox
price DESC, quantity