Collection - Formula field

Hey! Would you have any guidance on formula nomenclature / rules for the formula field in collections? Thanks in advance!

Hi @moti -

Collection Formula fields take the form:

name: my_formula
label: My Formula
type: FORMULA
formula:
  expression: myuser/myapp.number > 5
  returntype: CHECKBOX

We support the following:

  • Modifiers: + - / * & | ^ ** % >> <<
  • Comparators: > >= < <= == != =~ !~
  • Logical ops: || &&
  • Numeric constants, as 64-bit floating point (12345.678)
  • String constants (double quotes: “foobar”)
  • Date function ‘Date(x)’, using any permutation of RFC3339, ISO8601, ruby date, or unix date
  • Boolean constants: true false
  • Parentheses to control order of evaluation ( )
  • Json Arrays : [1, 2, “foo”]
  • Json Objects : {“a”:1, “b”:2, “c”:“foo”}
  • Prefixes: ! - ~
  • Ternary conditional: ? :
  • Null coalescence: ??

In addition to string, boolean, and number constants, you can use a ues.io field as an identifier. Currently, you must use the fully qualified field name in your expression. For example: myuser/myapp.myfield

name: initials
type: FORMULA
label: Initials
formula:
  expression: "myuser/myapp.firstname ? FIRST(myuser/myapp.firstname) + FIRST(myuser/myapp.lastname) : FIRST(myuser/myapp.username)"
  returntype: TEXT

We also provide the following functions:

  • STR_LEN - returns the length of a string.
  • TO_STRING - converts a value into a string.
  • IS_BLANK - returns true if a string value is empty.
  • TO_NUMBER - converts a value into a number.
  • FIRST - returns the first character of a string.
  • NOW - returns the current unix timestamp

Hope this helps! Let us know if you have any further questions.