Expression Parser
The product provides support for defining expressions that may be of a mathematical or logical/boolean nature. The expression may include variables and functions.
The data explorer column parameter is an example of where this may be used. That parameter supports the definition of a formula. Edge applications may include support for a formula or expression using this parser as well. For example, several application include a type of ‘rule’ object (calculation rule, form rule or usage rule) that is used for validation or calculation that may support applying a formula.
The following tables highlight what is supported in the expressions that use this parser.
Category | Supported in Expression | Description |
---|---|---|
Data types | Number | |
String | ||
Boolean | ||
List | ||
Literals | Numbers | |
Strings surrounded with either single quote or double quote. Note: 'Escaping' special characters is not currently supported.
|
||
Boolean values: true and false. | ||
Operations | + | Plus |
— | Minus | |
/ | Division | |
* | Multiplication | |
^ or ** | Power | |
% | Modulus | |
Logical operations | = | Equal |
> | Greater than | |
>= | Greater than or equal to | |
< | Less than | |
<= | Less than or equal to | |
!= or <> | Not equal to |
This table identifies the functions that are supported. Note that several of the functions are applicable to a list of values. Note that although the functions are listed in lower case, the column parameter syntax in data explorer indicates referencing the functions as all capital letters. The system converts the data explorer column formula to lowercase before being evaluated.
Function | Parameter | Results | Comments |
---|---|---|---|
size( ) | List element | Number of elements in the list. | |
isEmpty( ) | List element | Returns true if the list is empty. | |
sum( ) | List element of type 'number' | Returns the sum of the numbers in the list. | |
avg( ) | List element of type 'number' | Returns the average of the numbers in the list. | |
One or more numbers separated by commas | Returns the average of the number arguments. | ||
max( ) | List element | Returns the largest value in the list. | |
One or more comparable elements. | Returns the largest value of the number arguments. | ||
min( ) | List element | Returns the smallest value in the list. | |
One or more comparable elements. | Returns the smallest value of the number arguments. | ||
abs( ) | Number | Returns the absolute value. | |
ceiling( ) | Number | Rounds the number to the ceiling. | |
exp10( ) | Number | Raises 10 to the number power. | |
acos( ) | Number | Returns the arc cosine of the number in radians. | The result will lose precision, as it uses the system's double float based functions. |
asin( ) | Number | Returns the arc sine of the number radians. | The result will lose precision, as it uses the system's double float based functions. |
atan( ) | Number | Returns the arc tangent of the number radians. | The result will lose precision, as it uses the system's double float based functions. |
cos( ) | Radian | Returns the cosine of the radian angle input. | The result will lose precision, as it uses the system's double float based functions. |
exp( ) | Number | Raises e to the number power. | The result will lose precision, as it uses the system's double float based functions. |
log10( ) | Number | Takes the log, base 10, of the number. | The result will lose precision, as it uses the system's double float based functions. |
log( ) | Number | Takes the natural log (base e) of the number. | The result will lose precision, as it uses the system's double float based functions. |
sin( ) | Radian | Returns the sine of the radian angle input. | The result will lose precision, as it uses the system's double float based functions. |
sqrt( ) | Number | Returns the square root of the number. | The result will lose precision, as it uses the system's double float based functions. |
tan( ) | Radian | Returns the tangent of the radian angle input. | The result will lose precision, as it uses the system's double float based functions. |
floor( ) | Number | Rounds the number to the floor. | |
round( ) | Number | Assumes a scale of 0. The default rounding mode of “round half up” is applied. | |
Number, Scale | The default rounding mode of “round half up” is applied. | ||
Number, Scale, Mode | The mode must be set to one of the following:
|
||
negate( ) | Number | Returns the negative value of the number. | Only available in data explorer. |
The following are special functions supported in the application for a list of values. In each case, the syntax is function [ indexVariable in listName | expression using indexVariable ], where the indexVariable is chosen by the formula writer to represent each entry in the list and the expression used to evaluate each entry must reference that variable.
Function | Description | Examples |
---|---|---|
any [ ] | This function returns the value true if any of the entries in list satisfies the expression. | The following returns true if any entry in the Balance list is greater than 0.
|
all [ ] | This function returns the value true if all of the entries in the list satisfy the expression. | The following returns true if all phone numbers are populated.
|
collect [ ] | This function returns a new list of elements from the referenced list where the value of each entry of the new list is the result of the expression applied to each original value. | The following returns a new list with the tax rate applied
to each amount.
|
select [ ] | This function returns a list of all the values of the original list that satisfy the Boolean expression. | The following returns a new list with only the amounts that
are negative numbers.
|
reject [ ] | This function returns a list of all the values of the original list that do not satisfy the Boolean expression. | The following returns a new list with only the amounts that
are not negative numbers.
|