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:
-
quantity
of typeNumber
-
price
of typeNumber
-
name
of typeString
-
visible
of typeCheckbox
quantity = 0 or price = zero
visible AND name LIKE 'a%'
Comparison operators
- Equal
-
-
=
-
- Not equal
-
-
!=
-
<>
-
- Less than
-
-
<
-
- Less than or equal to
-
-
<=
-
- Greater than
-
-
>
-
- Greater than or equal to
-
-
>=
-
- 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.
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 (NULL
values come first). This is the default sort if noDIRECTION
is specified. -
DESC
: Sort in ascending order, lower values last (NULL
values come last).
For the following examples, let us assume that we have a module named test
with the following fields:
-
quantity
of typeNumber
-
price
of typeNumber
-
name
of typeString
-
visible
of typeCheckbox
price DESC, quantity