You are reading the documentation for an outdated Corteza release. 2023.9 is the latest stable Corteza release.

Expression Reference

Conjunction

and

Returns true if all elements are true, else if otherwise.

  • <Boolean>[ && <Boolean>[…​]]<Boolean>

  • <Boolean>[ and <Boolean>[…​]]<Boolean>

  • and(<Boolean>[, <Boolean>, …​]])<Boolean>

  • bool_field && true

  • (field == 'value') && bool_field

  • bool_field and true

  • (field == 'value') and bool_field

  • and(bool_field, true)

  • and((field == 'value'), bool_field)

or

Returns true if any element is true, else if otherwise.

  • <Boolean>[ || <Boolean>[…​]]<Boolean>

  • <Boolean>[ or <Boolean>[…​]]<Boolean>

  • or(<Boolean>[, <Boolean>, …​]])<Boolean>

  • bool_field || true

  • (field == 'value') || bool_field

  • bool_field or true

  • (field == 'value') or bool_field

  • or(bool_field, true)

  • or((field == 'value'), bool_field)

Comparison

equals

Returns true if types are comparable and the values match.

  • <Any> = <Any><Boolean>

  • <Any> == <Any><Boolean>

  • <Any> === <Any><Boolean>

  • eq(<Any>, <Any>)<Boolean>

  • field == 'value'

  • number == 10

  • year(dateField) == year(now())

  • eq(field, 'value')

  • eq(number, 10)

  • eq(year(dateField), year(now()))

not equals

Returns true if types are not comparable or the values don’t match.

  • <Any> != <Any><Boolean>

  • <Any> !== <Any><Boolean>

  • ne(<Any>, <Any>)<Boolean>

  • field != 'value'

  • number != 10

  • year(dateField) != year(now())

  • ne(field, 'value')

  • ne(number, 10)

  • ne(year(dateField), year(now()))

less than

Returns true if the left value is less than the right value.

  • <Any> < <Any><Boolean>

  • lt(<Any>, <Any>)<Boolean>

  • field < 'value'

  • number < 10

  • year(dateField) < year(now())

  • lt(field, 'value')

  • lt(number, 10)

  • lt(year(dateField), year(now()))

less than or equal to

Returns true if left value is less than or equal to the right value.

  • <Any> ⇐ <Any><Boolean>

  • le(<Any>, <Any>)<Boolean>

  • field ⇐ 'value'

  • number ⇐ 10

  • year(dateField) ⇐ year(now())

  • le(field, 'value')

  • le(number, 10)

  • le(year(dateField), year(now()))

greater than

Returns true if left value is greater than the right value.

  • <Any> > <Any><Boolean>

  • gt(<Any>, <Any>)<Boolean>

  • field > 'value'

  • number > 10

  • year(dateField) > year(now())

  • gt(field, 'value')

  • gt(number, 10)

  • gt(year(dateField), year(now()))

greater or equal than

Returns true if left value is greater than or equal to the right value.

  • <Any> >= <Any><Boolean>

  • ge(<Any>, <Any>)<Boolean>

  • field >= 'value'

  • number >= 10

  • year(dateField) >= year(now())

  • ge(field, 'value')

  • ge(number, 10)

  • ge(year(dateField), year(now()))

String Comparison

like

Returns true if the left value matches the pattern on the right.

  • <String> like <String><Boolean>

  • like(<String>, <String>)<Boolean>

  • field like 'value'

  • field like 'va_ue'

  • name like 'test%'

  • like(field, 'value')

  • like(field, 'va_ue')

  • like(name, 'test%')

not like

Returns true if the left value does not match the pattern on the right.

  • <String> not like <String><Boolean>

  • nlike(<String>, <String>)<Boolean>

  • field not like 'value'

  • field not like 'va_ue'

  • name not like 'test%'

  • nlike(field, 'value')

  • nlike(field, 'va_ue')

  • nlike(name, 'test%')

String Operation

concat

.Signatures: * concat(<String>[, <String>, …​]])<String>

.Expression examples:

.Function examples: * concat('a', 'b') * concat(field, 'b')

Arithmetic

add

Adds the two numbers.

  • <Number> + <Number><Number>

  • add(<Number>, <Number>)<Number>

  • 100 + 20

  • number + 10

  • year(dateField) + year(now())

  • add(100, 20)

  • add(number, 10)

  • add(year(dateField), year(now()))

sub

Subtracts the two numbers.

  • <Number> - <Number><Number>

  • sub(<Number>, <Number>)<Number>

  • 100 - 20

  • number - 10

  • year(dateField) - year(now())

  • sub(100, 20)

  • sub(number, 10)

  • sub(year(dateField), year(now()))

mult

Multiplies the two numbers.

  • <Number> * <Number><Number>

  • mult(<Number>, <Number>)<Number>

  • 100 * 20

  • number * 10

  • year(dateField) * year(now())

  • mult(100, 20)

  • mult(number, 10)

  • mult(year(dateField), year(now()))

div

Divides the two numbers amongst each other.

  • <Number> / <Number><Number>

  • div(<Number>, <Number>)<Number>

  • 100 / 20

  • number / 10

  • year(dateField) / year(now())

  • div(100, 20)

  • div(number, 10)

  • div(year(dateField), year(now()))

Aggregation

count

Returns the number of items.

  • count()<Number>

sum

Returns the sum of the items.

  • sum(<Number>)<Number>

  • field + current_column

  • sum(field)

max

Returns the maximum of two values.

  • max(<Number>)<Number>

  • max(field)

min

Returns the minimum of two values.

  • min(<Number>)<Number>

  • min(field)

avg

Returns the average of two values.

  • avg(<Number>)<Number>

  • avg(field)

Date Manipulation

now

Returns the current timestamp.

  • now()<DateTime>

quarter

Returns the quarter of the timestamp.

  • quarter(<DateTime>)<Number>

  • quarter(date_field)

  • quarter(now())

  • quarter(date('2021-01-01T01:00:00Z'))

year

Returns the year of the timestamp.

  • year(<DateTime>)<Number>

  • year(date_field)

  • year(now())

  • year(date('2021-01-01T01:00:00Z'))

month

Returns the month of the timestamp.

  • month(<DateTime>)<Number>

  • month(date_field)

  • month(now())

  • month(date('2021-01-01T01:00:00Z'))

Typecast

float

Casts the value to a float.

  • float(<Any>)<Float>

  • float(some_field)

  • float('10.9')

  • avg(cost) > float(10.9)

string

Casts the value to a string.

The string length for PostgreSQL and MySQL is limited to 8192 characters.

  • string(<Any>)<String>

  • string(some_field)

  • string('10.9')

int

Casts the value to an integer.

  • int(<Any>)<Int>

  • int(some_field)

  • int('10.9')

  • avg(cost) > int(10.9)

date

Casts the value to a timestamp.

  • date(<Ant>)<DateTime>

  • date(some_field)

  • date('2021-01-01T01:00:00Z')