Simple evaluation
Description
The Simple evaluation action evaluates the contents of a variable, a field in the result stream, the number of result files, or the log text of the previous workflow action.
Connect two actions with the output of the Simple Evaluation.
The green (success) hop will be called if the condition was evaluated successfully, the red (failure) one will be called if the condition wasn’t evaluated successfully.
Usage
-
A Null value is the same as an empty string. For example, to detect a null for any data type, set the Type to String, and the Success condition to "If value is equal to", and have the Value textbox empty.
-
The Simple evaluation Action is limited. For more complex conditions see: https://hop.apache.org/manual/latest/workflow/actions/eval.html
Options
| Option | Description |
|---|---|
Action name |
The name of the workflow action. |
Source |
|
Evaluate |
Evaluation type:
|
Field name |
The field to evaluate (only shown when evaluating a field) |
Type |
Data type (hidden when evaluating result files or log text) |
Success On |
|
Success when source variable set |
The action will always success if the source variable was set otherwise it will fail. |
Success condition |
|
Value |
The value to compare. |
Result
What this action passes on to the next action. See Action results for how results travel through a workflow.
| Result | Value |
|---|---|
True |
The condition under Success On is met. With Success when source variable set, the variable is set. |
False |
The condition is not met, and the number of errors is 0. When the value can’t be evaluated, the number of errors is 1: there are no result rows, the field doesn’t exist, the Variable name field is empty, or the value or the value to compare is not a valid number or date. |
Result files |
Passed on unchanged. With Number of result files, the action evaluates how many files it received. |
Result rows |
Passed on unchanged. With Field from previous result, the action evaluates the field in the first result row. |
| An invalid regular expression with If value valid regex doesn’t return false: the workflow stops with an error, and no hop is followed. |
Tips
Evaluating a variable
| Field | Value | Explanation |
|---|---|---|
Source: Evaluate |
Variable |
Select this to evaluate a variable set before |
Source: Variable name |
e. g. ${VAR1} |
Enter the variable name using the usual syntax |
Source: Type |
String, Number etc. |
The type of your variable |
Success on: Success when source variable set |
When this option is selected, the true path is followed when the source variable is set. Note: The workflow action checks if the source variable is defined, so an empty or null value is also true. When testing this within Hop you need to delete the line with the variable in the variables section of the Execute a workflow window. And remember: Once this variable is set, the variable keeps existing, even when deleting it from the list. |
|
Success On: Success condition |
Equal/Non equal/etc. |
Select the condition to be met for a successful result |
Success On: Value |
Value to compare the variable to |
Evaluating a field
| Field | Value | Explanation |
|---|---|---|
Source: Evaluate |
Field from previous result |
Select this to evaluate a field value (generated by a pipeline using Copy rows to result) |
Source: Field name |
Enter the field name from the result row |
|
Source: Type |
String, Number etc. |
The type of your field |
Success On: Success condition |
Equal/Non equal/etc. |
Select the condition to be met for a successful result |
Success On: Value |
Value to compare the field to |
Evaluating the number of result files
Use this to check how many files the previous action added to the workflow result (for example after Add filenames to result or a pipeline that adds files).
The source is treated as a number. Typical conditions are equal to, greater than, smaller than, or between.
| Field | Value | Explanation |
|---|---|---|
Source: Evaluate |
Number of result files |
Select this to evaluate how many files the previous action added to the result |
Success On: Success condition |
Equal/Greater than/Between/etc. |
Compare the file count |
Success On: Value |
Expected number of result files |
Evaluating log text from the previous result
Use this to verify that a previous pipeline or workflow action logged an expected snippet, or that an unwanted snippet is absent.
The source is the log text captured for the previous action. It is treated as a string. Typical conditions are If value contains and If value not contains. Regular expressions are also supported.
This is a no-code alternative to checking the previous result log text in a JavaScript action.
| Field | Value | Explanation |
|---|---|---|
Source: Evaluate |
Log text from previous result |
Select this to evaluate the previous action’s log text |
Success On: Success condition |
Contains/Not contains/Regex/etc. |
Check for presence or absence of a snippet |
Success On: Value |
The text snippet or regular expression to look for |