Skip to content

Expression Evaluator#

image45

The Expression Evaluator task is one of the most powerful tasks shipped by default. It can be used to make several operations upon inputs in order to generate an output. It can make operations using the mathjs engine, XPath and Regular Expressions, it can also be used to evaluate expressions until one of the outputs evaluates a Boolean true result (as with the "if (condition) else" statement).

image47

Warning

This task is currently deprecated and will be removed in future versions.

Inputs#

Name Data Type IsTrigger Description
<custom list> <custom> Yes Type of value to perform operations in order to generate an output
Activate any Yes Activates the task

Outputs#

Name Data Type Description
<custom list> <custom> Type of value to perform operations in order to generate an output
Error Error Error that occurred during the processing of this task

Settings#

On the General Tab, you have the usual settings and the following setting:

Name Data Type Values Default Value Description
Expression Type enum Generic
XPath
RegularExpression
Generic Types of expression it can evaluate
Evaluator Behavior enum EvaluateAll
EvaluateUntilTrue
EvaluateAll Different types of logic the task can have when evaluating the expression
Clear Inputs Boolean false After being triggered resets the inputs

image48

On the Inputs Tab you have the following setting:

Name Data Type Default Value Description
Name String Input Name.
Type Long
Decimal
DateTime
Boolean
String
Integer
The type of input value.
Collection Type None
Array
Map
Default Value any The default value of an input parameter.

image49

On the Outputs Tab you have the following setting:

Name Data Type Default Value Description
Name String Output Name.
Type Long
Decimal
DateTime
Boolean
String
Integer
The type of output value.
Collection Type None
Array
Map
Expression any The operation you wish to apply to the input.

image50

Note

For testing you also have an Input. You can try with a dummy input values and evaluate your expression.

Behavior#

The Generic Type will use the mathjs engine, which is a math library for javascript, and can therefore use math operations as well as some native javascript. The XPath type searches in the given object for the path and returns the value or array of values that corresponds to said path. The Regular Expression type applies a regular expression to the input value and returns the value or array of values that corresponds to the result of the expression. The Clear Inputs, if true, will reset the inputs after the task is triggered. The EvaluateUntilTrue when the expression returns a true value will output the first value as true, in opposition to the EvaluateAll that will evaluate every expression output and emit all the values.

Tip: You can test your mathjs expression at https://jsbin.com/devacu/edit?html,js,output , you can also see the documentation of what's available at http://mathjs.org/docs/expressions/syntax.html and at http://mathjs.org/docs/reference/functions.html ⧉ .

Remarks#

This task is a very powerful tool for operations to an input value and mathjs has several typical javascript functions, but mathjs is not a javascript engine, so native javascript code may or may not work on the mathjs engine.