Conditional
Conditional node can be used to divert a pipeline execution by using conditional logic ( Javascript code ).
We can write javascript code in this node and compare event values to perform logical comparison. For the comparison to occur, we will need to write a Javascipt function with condition as the name together with the logic in the code field of the node. This node will have 2 output port for true and false conditions.
Action Fields
Name
Name field can be used to give a custom name to the node.
Code
We can write a function named `condition` in this field and we should receive a boolean value after it is executed. The condition function will receive the payload as function parameters which can be used to perform logical operations.
The following example shows the implementation of a condition function. The example compares temperature using payload.
function condition(payload) {
if(payload.temperature > 27) {
return true;
}
else {
return false;
}
}