Conditional block
Purpose:
Compare data. Outputs 'true', if the condition is met. The following comparisons can be done:
type | Description |
---|---|
eq* | Equals |
ne* | Not equals |
gt | Greater than |
gte | Greater than or equal |
lt | Lower than |
lte | Lower than or equal |
- The
eq
andne
will allow a undefined to be the same as anull
Input:
-
Fist value
Can be any type of data. Is forgotten when output has been provided. -
Secound value
Can be any type of data. Is forgotten when output has been provided.
Output:
- Boolean
Only outputs 'true' if condition has been met. Will only output, when both values are set.
Example:
Often used to create 'if-else' statements. Works very well with DateTime
. Here we want to do one thing, if the time and date is before today, and something else, if it's after.
graph LR A([1995-08-15T12:00:00]) --First value--> C(Conditional 'lte') B([Today]) --Secound value--> C A --First value--> D(Conditional 'gt') B --Secound value--> D C --True--> E{Before today} D --False--> F{After today}
Caveats
- If you want to make a comparison to a static value, make sure it is set everytime a comparision is being made, since the block will not remeber anything. JSON Decode is very usefull here.
- With everything other than 'eq' and 'ne', make sure to read it out like this:
First value
is greater than or equal tosecond value
.