Compare
Uncontrolled node
Overview
The Compare node evaluates a comparison between two input values and outputs a boolean result. It supports standard comparison operators including less than, greater than, and equality checks. This node is useful for creating conditional logic in workflows, filtering data, or validating that values meet specific criteria.
The node performs loose comparisons (using JavaScript's == operator for equality), allowing you to compare numbers, strings, or mixed types where applicable.
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| a | Text | The first value to compare. | - |
| b | Text | The second value to compare. | - |
| Operation | Enum | The comparison operator to use. Options: a < b, a <= b, a == b, a >= b, a > b. | a == b |
Outputs
| Output | Type | Description |
|---|---|---|
| Result | Boolean | true if the comparison condition is met, false otherwise. |
Runtime Behavior and Defaults
The Compare node is an uncontrolled node, meaning it executes automatically whenever either input a or b changes. It does not require an event trigger to run.
- Default Operation: The node defaults to equality comparison (
==) if no operation is specified. - Comparison Logic:
- For numeric comparisons, standard arithmetic comparison is used.
- For string comparisons, lexicographic (alphabetical) ordering is used.
- Mixed type comparisons follow JavaScript's loose equality rules.
- Output: The
resultoutput always contains a boolean value (trueorfalse). If an unrecognized operation is specified, the node returnsfalseby default.
Example Usage
Scenario: Check if a user's score is greater than or equal to a passing threshold.
- Connect a Number node (or any data source) outputting the user's score to input
a. - Connect another Number node with the value
70(the passing threshold) to inputb. - Set the Operation property to
a >= b. - Connect the Result output to an If node's
testinput to branch the workflow based on whether the user passed.
Alternative: To check if two values are exactly equal (useful for validation), leave the operation as a == b and connect the values you want to compare to inputs a and b.