Query language
Corteza implements an SQL-like syntax for querying and sorting records.
Querying
The general template for constructing a query looks like this:
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
To query for records with zero quantity or zero price:
quantity = 0 or price = zero
To query all visible records starting with the letter "a":
visible AND name LIKE 'a%'
Sorting
The general template for constructing a sort looks like this:
FIELD[ DIRECTION][, FIELD[ DIRECTION] [...]]
Supported directions:
-
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
To order records, descending by price and ascending by quantity:
price DESC, quantity