--- alias: user-guide-automation-task-core-expressionevaluator tags: - automation tasks description: "This documentation details a task for evaluating expressions, offering flexibility in input and output types" --- # Expression Evaluator :iot-arithmeticoperation-lg:{style="font-size: 100px"} The **Expression Evaluator** task performs various operations on input values to produce an output. It supports mathematical expressions through the mathjs engine, XPath queries, and Regular Expressions. It can also evaluate multiple expressions until one returns a Boolean true, similar to an if (condition) else statement. ![Screenshot showing the Expression Evaluator interface.](../images/image47.png) !!! warning This task is deprecated and will be removed starting with version 12. Its functionality has been split into three separate actions: [[user-guide-automation-task-core-expressionevaluatorgeneric]], [[user-guide-automation-task-core-expressionevaluatorregular]], and [[user-guide-automation-task-core-expressionevaluatorxpath]]. ## Workflows | Data Flow | Control Flow | | :--------: | :---------: | | :material-check:{ style="color: #4DB6AC" } | :material-close:{ style="color: #EF5350" } | ## Inputs | Name | Data Type | Description | | --------------- | ---------- | ------------------------------------------------------------------ | | `` | `` | Defines the input values used in the operation | | Activate | `any` | Triggers the task | ## Outputs | Name | Data Type | Description | | --------------- | ---------- | ------------------------------------------------------------------ | | `` | `` | Defines the output values generated by the operation | | Error | `Error` | Details about any error that occurs during processing | ## Settings The General tab includes standard task settings and the following parameters: | Name | Data Type | Values | Default Value | Description | | ---- | --------- | ------ | ------------- | ----------- | | Expression Type | `enum` | `Generic`
`XPath`
`RegularExpression` | `Generic` | Defines the type of expression to evaluate | | Evaluator Behavior | `enum` | `EvaluateAll`
`EvaluateUntilTrue` | `EvaluateAll` | Determines whether all expressions are evaluated or the evaluation stops when a `true` result is found | | Clear Inputs | `Boolean` | | false | When enabled, clears input values after the task is triggered | ![Screenshot showing a settings page with an option for selecting the type of expression.](../images/image48.png) The Inputs Tab includes the following settings: | Name | Data Type | Description | | ---- | --------- | ----------- | | Name | `String` | Input Name | | Type | `Long`
`Decimal`
`DateTime`
`Boolean`
`String`
`Integer` | Defines the input data type | | Collection Type | `None`
`Array`
`Map` | Specifies the structure of the input | | Default Value | `any` | Default value assigned to the input parameter | ![Screenshot showing settings options for collection type, including None, Array, and Map.](../images/image49.png) The Outputs Tab includes the following settings: | Name | Data Type | Description | | ---- | --------- | ----------- | | Name | `String` | Output Name | | Type | `Long`
`Decimal`
`DateTime`
`Boolean`
`String`
`Integer` | Defines the output data type | | Collection Type | `None`
`Array`
`Map` | Specifies the structure of the output | | Expression | `any` | Operation applied to the input value | ![Screenshot showing settings for an expression evaluator, with options for collection type including None, Array, and Map.](../images/image50.png) !!! note Expressions can be tested by entering sample input values and evaluating the result. ## Action Settings ### Expression Type `Generic` The `Generic` expression type uses the mathjs library, a JavaScript-based math engine. It supports mathematical operations and a subset of native JavaScript functions. ### Expression Type `XPath` The `XPath` expression type searches for a specific path within an object and returns the value or an array of values corresponding to that path. ### Expression Type `Regular Expression` The `Regular Expression` expression type applies a pattern to the input value and returns matching results as a single value or array. ### Evaluator Behavior - `EvaluateUntilTrue`: Stops processing when an expression returns a `true` value and outputs the corresponding result. - `EvaluateAll`: Evaluates all configured expressions and outputs all results. - `Clear Inputs`: When enabled, resets the inputs after task execution. !!! note Test `mathjs` expression at . Additional documentation is available at and . ## Remarks The **Expression Evaluator** provides flexible operations for transforming input data. While mathjs supports many JavaScript-like functions, it is not a full JavaScript engine; some native JavaScript code may not execute as expected.