Supported Functions and Operators
You can view the following details:
- The supported functions in calculated fields
- The supported mathematical operators in calculated fields
- The supported logical operators in calculated fields
The following functions are supported:
| Function Name | Example | Description |
|---|---|---|
| ToString | string ToString(number or datetime or boolean $input) | Converts a number, a datetime or a boolean to string format. |
| Duration | number Duration (datetime $startDate, datetime $endDate, string $unit) | Calculate the time difference between the start date and end date. The output is calculated by the unit and given in number format. Supported unit includes week, day, hour and minute. |
| Year | number Year (datetime $date) | Subtract the year from a date |
| Month | number Month (datetime $date) | Subtract the month from a date, a number between 1(January) and 12(December) |
| Day | number Day (datetime $date) | Subtract the day from a date, a number between 1 and 31 |
| Hour | number Hour (datetime $date) | Subtract the hour from a date, a number between 0 and 23 |
| WeekofYear | number WeekofYear (datetime $date) | Subtract the week from a date, a number between 0 and 53 |
| Now | datetime Now () | Returns the current time in datetime format |
| Ceil | number Ceil (number $input) | Returns the smallest integer that is greater or equal to the given number. |
| Floor | number Floor (number $input) | Returns the largest integer that is smaller or equal to the given number. |
| IF | number or string or datatime IF (logical expression $expression, $value_if_true, $value_if_false) | First verifies if an expression is true or false, then returns a given value based on the verification result. The data type of variable $value_if_true and $value_if_false should be same. |
The following mathematical operators are supported:
| Operator | Example | Description |
|---|---|---|
| + |
number A + number B string A + string B
|
Add two numbers and return the sum in number format, or combines string A and string B and returns the result in string format |
| - |
number A - number B
|
Subtract two numbers and return the difference in number format |
| * | number A * number B | Multiply two numbers and return the result in number format |
| / | number A / number B | Divide two numbers and return the result in number format |
| ^ | number A ^ number B | Raises number A to the power of number B and returns the result in number format |
| () | (number A + number B) * number C | The expressions within the parenthesis are evaluated first |
The following logical operators are supported:
| Operator | Example | Description |
|---|---|---|
| < |
number A < number B datatime A < datatime B |
Evaluate if number A is smaller than number B, or datetime A is smaller than datetime B and returns the result in boolean format. |
| > |
number A > number B datatime A > datatime B |
Evaluate if number A is greater than number B, , or datetime A is greater than datetime B and returns the result in boolean format. |
| <= |
number A <= number B datatime A <= datatime B |
Evaluate if number A is smaller than or equal to number B, or datetime A is smaller than or equal to datetime B and returns the result in boolean format. |
| >= |
number A >= number B datatime A >= datatime B |
Evaluate if number A is greater than or equal to number B, or datetime A is greater than or equal to datetime B and returns the result in boolean format. |
| = or == |
number A = number B number A == number B string A = string B string A == string B boolean A = boolean B boolean A == boolean B datatime A = datatime B datatime A == datatime B
|
Evaluate if two numbers, two strings, two booleans or two datetimes are equal returns the result in boolean format. The operator = is equal to operator == |
| != |
number A != number B string A != string B boolean A != boolean B datatime A != datatime B
|
Evaluate if two numbers, two strings, two Booleans, or two datetimes are not equal returns the result in boolean format. |
| && or AND |
boolean A && boolean B boolean A AND boolean B
|
Evaluate if two values or expressions are both true and return the result in boolean format. The operator && is an alternative to the logical function AND. |
| || or OR |
boolean A || boolean B boolean A OR boolean B
|
Evaluate if at least one of multiple values or expressions is true and returns the result in boolean format. The operator || is an alternative to the logical function OR. |
| ! or NOT |
! boolean A NOT boolean A |
Returns the opposite value of boolean A. The operator ! is equal to logical function NOT. |