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 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 |
|
|
The filter returns record/s where either one of the multi-value select options contains |
|
|
The filter returns record/s where either one of the multi-value select options doesn’t contain |
Sorting
FIELD[ DIRECTION][, FIELD[ DIRECTION] [...]]
-
ASC: Sort in ascending order, lower values first (NULLvalues come first). This is the default sort if noDIRECTIONis specified. -
DESC: Sort in ascending order, lower values last (NULLvalues come 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
Utilities
Returns quarter from the given timestamp. |
|
Returns year from the given timestamp. |
|
The function returns the date formatted by the provided format. Reference to date and time formatting |
|
Returns date from the given timestamp. |