Node reference
If
Branch using conditions
If chooses one of two paths. It forwards the incoming data through true when the conditions pass, or false when they do not. Use it for decisions such as whether a quantity needs attention.
Try it step by step#
- Add a Variable named quantity with the numeric value 3, then connect it to If.
- Set the left value to {{quantity}}, the operator to >=, and the right value to 2.
- Connect each output to a different Variable message. Run once, then change quantity to 1 and run again.
What to expect#
With quantity 3, only the true path runs. With quantity 1, only the false path runs. If forwards the original object; it does not replace it with a boolean.
Things to check#
- AND means both checks must pass; OR means either can pass. Keep mixed conditions small enough to inspect.
- Do not connect both alternatives into Merge and expect it to continue: Merge waits for every incoming connection, while If chooses one.
Keep learning#
Parameters#
| Setting | Default | What it does |
|---|---|---|
| Conditions | [{"left":"","operator":"==","right":""}] | Compare left and right values, then combine additional checks with AND or OR. |
Inputs#
| Port | Value | Description |
|---|---|---|
in | object | Payload evaluated by the configured condition. |
Outputs#
| Port | Value | Description |
|---|---|---|
true | object | Original payload routed when conditions pass. |
false | object | Original payload routed when conditions fail. |