The FUNCTION Namespace
The FUNCTION namespace is used for describing the built-in functions available.
An example function token has the following format
[[FUNCTION:functionname(param1, param2, paramN)]]
functionname: name of the function
paramX: list of parameters required for the function
when evaluation is performed and if successful the full token will be replaced by the returned value of the function.
TIP: Within the advanced tokens it is possible to embed standard tokens in the parameters so that they could also be evaluated and passed into the function for processing
The following table lists the available functions in Enterprise Forms
Function Name |
Description |
IF(evaluation expression, true expression, false expression) |
Performs and IF-ELSE evaluation on the provided evaluation expression and returns the true expression if evaluated successfully otherwise returns false expression
Examples:
1. IF(1 > 2, 3, 4)
The above IF function reads as, evaluate "1 > 2", if true returns the value "3" otherwise returns "4"
when evaluated the above expression returns the value "4" (quotes not included)
2. IF("StringOne" == "StringOne", "Strings are equal", "String are not equal")
The above IF function reads as
If "StringOne" == "StringOne" return "Strings are equal" else return "String are not equal"
when evaluated the above expression returns the value "Strings are equal" (quotes included)
NOTE: None numeric values are required to have double-quotes (") wrapped around the expressions for evaluation. Thus the function below is not valid and will generate an error when evaluated
IF(StringOne == StringOne, Strings are equal, String are not equal)
3. IF("[FORM:field1]" != "[FORM:field2]", "[FORM:field3]", "[FORM:field4]")
the above IF function reads as
If "value of field1" != "value of field2" return "value of field3" else return "value of field4"
NOTE: If is only possible to embed standard tokens in advanced token and not advanced tokens in advanced tokens.
|
SUM(params) |
Performs a summation on the list of provide params values. params is a list of coma separated numeric values
Examples:
1. SUM(1, 3, [FORM:field1])
the above SUM function reads as
return the sum of 1 + 3 + value of field1
NOTE: None numeric value will be parsed as 0, thus if value of field1 is "A" then the result from the above function is 4. |