Use of formulas in surveys
The following Constants, Operators and Functions can be used in formulas of surveys.
Standard Constants
The following Costants are available:
PI
3.14159265358979323846264338327950288419716939937510582097...
E
2.71828182845904523536028747135266249775724709369995957496...
Arithmetic operators
The following arithmetic operators are available:
-
The prefix minus operator, like in “-2”
+
The prefix minus operator, like in “+2”
The infix minus operator, like in “5-2”
+
The infix plus operator, like in “5+2”
*
The multiplication operator
%
The modulo operator (remainder)
Boolean operators
The following boolean operators are available:
!
The prefix not operator, like in !a
>
The greater than operator
>=
The greater equals operator
Basic Functions
The following basic functions are available:
ABS(value)
Absolute (non-negative) value
AVERAGE(value, …)
Returns the average value of all parameters
CEILING(value)
Rounds the given value an integer using the rounding mode CEILING
COUNT(value, …)
Returns the number of the parameters. NULL values are not counted.
FACT(base)
Calculates the factorial of a base value
FLOOR(value)
Rounds the given value an integer using the rounding mode FLOOR
IF(condition, resultIfTrue, resultIfFalse)
Conditional evaluation function. If condition is true, the resultIfTrue is returned, else the resultIfFalse value
LOG(value)
The natural logarithm (base e) of a value
LOG10(value)
The base 10 logarithm of a value
MAX(value, …)
Returns the maximum value of all parameters
MIN(value, …)
Returns the minimum value of all parameters
NOT(value)
Boolean negation, implemented as a function
RANDOM()
Produces a random value between 0 and 1
ROUND(value, scale)
Rounds the given value to the specified scale, using the current rounding mode
SUM(value, …)
Returns the sum of all parameters
String Functions
The following string functions are available:
STR_CONTAINS(string, substring)
Returns true, if the string contains the substring (case-insensitive)
STR_LOWER(value)
Converts the given value to lower case
STR_UPPER(value)
Converts the given value to upper case
Do you find this article helpful?