General purpose functions

Overview

Functions are used to build filters for selecting items from collections via REST-API, as well as functional field values that set aggregation parameters.

Function construction

Functions are defined as a JSON list, where the first element is the name of the function, and the following elements are the values of parameters, which in general case can also be functions.

The format for specifying a function without parameters:
["FunctionName"]
Example
["null"]
Format for specifying a function with 1 parameter:
["FunctionName",Arg]
Examples
["toYYYY","2021-12-01T13:08.25.22Z"]
["property","fieldname"]
Format for specifying a function with 2 parameters:
["FunctionName",Arg1,Arg2]
Examples
["+",3,5]
["or","true","false"]
["like","abc","a*c"]
Format for specifying a function with N parameters:
["FunctionName",Arg1,Arg2,...]
Examples
["+",3,5,6,8]
["list","a","bb","ccc","ddd"]
["join",", ","first","second","third"]
["like","abc","a*c"]

Construction of superposition of functions

A nested function can be specified as any argument. An arbitrary level of nesting is allowed.

Examples
["+",["property","x"],["property","y"]]
["toYYYY",["property","datetime"]]
["like","abc","a*c"]

["and",
  ["or",
    ["==",["property","name"],"abc"],
    ["contains",["property","name"],"qwe"],
    ["in",["property","p"],["list",3,6,9,12]],
  ["==",["rem",["property","value"],10],0]]

List of supported functions

  • isnull (arg)

  • isnotnull (arg)

  • not (arg), synonyms: !

  • bool (arg)

  • integer (arg)

  • float (arg)

  • string (arg)

  • uuid (arg)

  • const (arg)

  • lower (arg)

  • upper (arg)

  • year (arg), synonyms: toYYYY, toYear

  • quarter (arg)

  • month (arg)

  • day (arg)

  • hour (arg)

  • minute (arg)

  • second (arg)

  • weekday (arg)

  • toYYYYMM (arg)

  • toYYYYMMDD (arg)

  • concat (…​), synonyms: .

  • join (…​), synonyms: ..

  • list (…​), Example: '["list","a","b","c"]'. For postgresql it is converted to ('a','b','c').

  • array (…​), Example: '["list","a","b","c"]'. For postgresql it is converted to array['a','b','c'].

  • null ()

  • + (…​), synonyms: add

  • - (arg1, arg2), synonyms: sub

  • * (arg1, arg2), synonyms: mul

  • / (arg1, arg2), synonyms: div

  • // (arg1, arg2), synonyms: ddiv

  • % (arg1, arg2), synonyms: rem

  • && (…​), synonyms: and,

  • || (…​), synonyms: or,

  • == (arg1, arg2), synonyms: equal, equals

  • != (arg1, arg2), synonyms: notequal,notequals,<>

  • > (arg1, arg2), synonyms: greater,

  • >= (arg1, arg2), synonyms: notless, greaterorequal

  • < (arg1, arg2), synonyms: less

  • ⇐ (arg1, arg2), synonyms: notgreater, lessorequal

  • in (arg1, arg2), Example: '["in",["property","role"],["list","role1","role2"]]'

  • inlist (arg1, arg2), Example: '["inlist","admin",["property","roles"]]'

  • hasAny (arg1, arg2), Example: '["hasAny",["property","roles"],["array","role5","role7","role9"]]'

  • hasAll (arg1, arg2), Example: '["hasAll",["property","roles"],["array","role5","role7"]]'

  • contains (arg1, arg2)

  • like (arg1, arg2)

  • interval_in_minutes (arg1, arg2)

  • dateadd (arg1, arg2)

  • datediff (arg1, arg2)

  • between (arg1, arg2, arg3