Formula

Formula columns can be used to automatically compute a value based on some constants and on the values of other fields of the record.

Here is a description of how to use them in your application.

Basis

A formula may consist of the following elements:

Strings

A string must be enclosed in double quotes:

"My first formula"

Numbers

Integers and floats are allowed. Note that the decimal separator is the dot:

-10.2

Field names

Only fields of the current table are allowed.

The field name must be wrapped in curly braces and must be prefixed by COLUMN.

For instance:

COLUMN.{Name}

Not all the fields types can't be used in a formula.

For now, the following types are supported:

  • Boolean
  • Integer
  • Float
  • Single line text
  • Long text
  • Date
  • Date and time
  • Single select
  • User (the user name)
  • User group (the group name)
  • URL
  • Link to another table

You can also reference a Lookedup field if the type of the related field is specified in the previous list.

Functions

A function performs an operation and always returns a single value. It can also accept parameters which can be either a string, a number, a field reference or another function.

Functions are divided into four main categories:

  • DATE
  • LOGIC
  • NUMERIC
  • TEXT

The name of a function must be prefixed by its category, the two being separated by a dot. Then, if there are any, the parameters must be specified between brackets and separated by commas.

For instance:

TEXT.CONCAT("TASK: | COLUMN.{Name})

The previous formula contains the CONCAT function of the TEXT category and takes two parameters. The first one is a constant string whereas the second one references the Name field (string field).

To help you write your formulas, autocompletion is provided, listing the different functions with their associated documentation. Moreover, the purpose, the parameters and the return type of each function will be described in the next section.

Function documentation

Date functions

FunctionDescription
DATEADDDATEADD(date: date, number: int, unit: string) → date
Returns the date corresponding to the date a specified number of units ('year', 'month', 'day', 'hour', 'minute' or 'second') before or after the original one.
DAYDAY(date: date) → number
Returns a number corresponding to the day in the month of the specified date.
DAYSDAYS(date1: date, date2: date) → number
Returns the number of days between two dates.
EARLIEREARLIER(date1: date, date2: date): Boolean
Returns true is the first date is earlier than the second one, else returns false.
EQUALReturns true if the dates are equal, else returns false.
Returns true if the dates are equal, else returns false.
EOMONTHEOMONTH(date: date, count: number) → date
Returns the date of the last day of the month a specified number of months before or after the original date.
HOURHOUR(date: date) → number
Returns a number corresponding to the hour of the specified date.
LATERISAFTER(date1: date, date2: date): Boolean
Returns true is the first date is later than the second one, else returns false.
MINUTEMINUTE(date: date) → number
Returns a number corresponding to the minutes of the specified date.
MONTHMONTH(date: date) → number
Returns a number corresponding to the month of the specified date.
MONTHSMONTHS(date1: date, date2: date) → number
Returns the number of months between two dates.
SECONDSECOND(date: date) → number
Returns a number corresponding to the seconds of the specified date.
WEEKDAYWEEKDAY(date: date, [start: number]) → number
Returns a number corresponding to the day in the week of the specified date.
WEEKNUMWEEKNUM(date: date, [start: number]) → number
Returns a number corresponding to the week number in the year of the specified date.
YEARYEAR(date: date) → number
Returns a number corresponding to the year of the specified date.
YEARSYEARS(date1: date, date2: date) → number
Returns the number of years between two dates.

Logic functions

FunctionDescription
ANDAND(condition1: Boolean, [condition2: Boolean, …]) → Boolean
Returns true if all conditions are true, else returns false.
FALSEFALSE() → Boolean
Returns the false logical value.
IFIF(condition: Boolean, result1: any, result2: any)
Returns the first result if the condition is true, else the second one.
IFSIFS(condition1: Boolean, result1: any, [condition2: Boolean, result2: any, ...])
Returns the result associated to the first true condition.
NOTNOT(condition: Boolean) → Boolean
Returns false if the condition is true, else returns true.
OROR(condition1: Boolean, [condition2: Boolean, …]) → Boolean
Returns true if at least one parameter is true, else returns false.
SWITCHSWITCH(comparativeValue: any, case1: any, value1: Boolean, [case2: any, value2: Boolean, …, default: any])
Returns the result associated to the first case which is equal to the comparative value, or returns the default result.
TRUETRUE() → Boolean
Returns the true logical value.

Numeric functions

FunctionDescription
ABSABS(n: number) → number
Returns the absolute value of the specified number.
AVERAGEAVERAGE(nb1: number, [nb2: number, …]) → number
Returns the average of the specified numbers.
CEILINGCEILING(n: number) → number
Rounds up a number to the nearest integer if it is a float number, else returns the specified number if it is an integer.
DIVIDEDIVIDE(n1: number, [n2: number, …]) → number
Returns the result of the division of the specified numbers.
EE() → number
Returns the Euler number.
EQUALEQUAL(n1: number, n2: number, [..]) → Boolean
Returns true if the specified numbers are equal, else returns false.
FLOORFLOOR(n: number) → number
Rounds down a number to the nearest integer if it is a float number, else returns the specified number if it is an integer.
GREATERGREATER(n1: number, n2: number, […]) → Boolean
Returns true if the first number is greater than the second one, else returns false.
GREATEREQGREATEREQ(n1: number, n2: number, […]) → Boolean
Returns true if the first number is greater than the second one or if the two numbers are equal, else returns false.
INTINT(n: number) → number
Rounds the specified number to the nearest integer.
LESSLESS(n1: number, n2: number, […]) → Boolean
Returns true if the first number is lower than the second one, else returns false.
LESSEQLESSEQ(n1: number, n2: number, […]) → Boolean
Returns true if the first number is lower than the second one or if the two numbers are equal, else returns false.
LOGLOG(n: number, base: number) → number
Returns the result of the logarithm function applied to the number with the specified base.
MAXMAX(nb1: number, [nb2: number...]) → number
Returns the largest number among the specified ones.
MINMIN(nb1: number, [nb2: number, …]) → number
Returns the smallest number among the specified ones.
MODMOD(n: number, divisor: number) → number
Returns the remainder from the division of two numbers.
PIPI() → number
Returns the PI number.
PRODUCTPRODUCT(n1: number, [n2: number, …]) → number
Returns the result of the product of numbers.
ROUNDROUND(n: number, digits: number) → number
Rounds a number to a specified number of digits.
SIGNSIGN(n: number) → number
Returns -1 if the specified number is negative, 0 if it is a zero number and 1 if it is positive.
SQRTSQRT(n: number) → number
Returns the square root of the specified number.
SUBTRACTSUBTRACT(n1: number, [n2: number, …]) → number
Returns the result of the subtraction of the specified numbers.
SUMSUM(n1: number, [n2: number, …]) → number
Returns the result of the sum of the specified numbers.
UNEQUALUNEQUAL(n1: number, n2: number, […]) → Boolean
Returns true if the specified numbers aren't equal, else returns false.

Text functions

FunctionDescription
CONCATCONCAT(str1: string, [str2: string, …]) → string
Returns the concatenation of the specified texts.
EXACTEXACT(str1: string, [str2: string, …]) → Boolean
Returns true if the specified texts are equal, else returns false.
FINDFIND(searchedString: string, searchAreaString: string, [startPos: number]) → number
Returns the position of the first occurrence of the searched text inside the other text, or 0 if the searched text is not included in the other one.
LEFTLEFT(str: string, count: number) → string
Returns the first characters of the text.
LENLEN(str: string) → number
Returns the length of the text.
LOWERLOWER(str: string) → string
Returns a lowercase copy of the text
MIDMID(str: string, startPos: number, count: number) → string
Returns a specific number of characters from a given position of the specified text.
REPLACEREPLACE(originalString: string, startPos: number, count: number, pattern: string) → string
Returns a copy of the original text in which a specific number of characters are replaced by a pattern from a given position.
REPTREPT(str: string, n: number) → string
Returns a text containing a specific number of times the original text.
RIGHTRIGHT(str: string, count number) → string
Returns the last characters of the text.
SUBSTITUTESUBSTITUTE(searchedString: string, originalString: string, newString: string, [occurrenceIndex: number]) → string
Returns a copy of the original text in which a pattern is replaced by a newer one.
TEXTJOINTEXTJOIN(separator: string, str1: string, [str2: string, …]) → string
Returns the concatenation of the specified texts, separated by a given separator.
TRIMTRIM(str: string) → string
Returns a copy of the original text without any spaces at the starting and the ending.
UPPERUPPER(str: string) → string
Returns an uppercase copy of the text.