Rule Builder Node Configuration Guide

The Rule Builder Node is used to apply conditional logic within a workflow. It allows users to define one or more if statements using structured conditions and automatically translates these into JavaScript.

What It Does

The Rule Builder Node evaluates one or more conditional expressions and returns a computed result. Each condition can include comparisons between fields, constants, and functions. It is commonly used to transform data, apply thresholds, or drive branching behavior based on real-time values.

This node also generates and previews the corresponding JavaScript logic internally for validation and transparency.


Step-by-Step: How to Configure the Rule Builder Node

  1. Add the node

    • Drag the Rule Builder Node from the Logic panel into the workflow.

  2. Connect input source

    • Connect a node that emits data to be evaluated by your rule.

  3. Open configuration

    • Double-click the Rule Builder Node to access its configuration interface.


Configuration Fields

Field Requirement Description
Node Name* Required Internal name for this node.
Error Handling Action* Required What to do if an error occurs (e.g., input missing, logic failure):
Continue – Add Error to JSON includes an error field in the output instead of breaking the flow.
Output Zero if Value Not Found Optional If enabled, the output will default to 0 when referenced values are undefined. This prevents failure due to missing keys.
 

Condition Builder

Each rule is created using a Condition section that defines logic in an if format.

Field Description
If Defines the left-hand side of the condition (e.g., temperature > 100).
Operator Logical or comparison operator (e.g., ==, !=, <, >, contains, etc.)
Value Value or expression to compare the field against.
 

Multiple conditions can be added and combined using AND/OR logic. All expressions are compiled into JavaScript and executed in order.


Output Behavior

The output is typically a single field or JSON object with:

  • The result of the rule evaluation

  • An optional error object if error handling is enabled and the evaluation fails

  • Optional default values (e.g., 0) when configured

Example Output:

 
{
"status": "alert",
"rule_output": 1
}

Best Practices

  • Use explicit key names in your condition logic to avoid mismatches due to dynamic payload structure.

  • Enable “Output Zero if Value Not Found” in loosely structured environments (e.g., non-required fields or nested keys).

  • Use Preview JS Code to validate the generated logic before saving.

  • Avoid deeply nested conditionals—simplify complex logic into multiple Rule Builder nodes where needed.


Use Cases

  • Trigger alerts when a temperature or sensor value crosses a threshold

  • Set status flags based on multiple field conditions

  • Calculate binary outputs (e.g., 1 or 0) for downstream aggregation or charting

  • Normalize inconsistent data by replacing undefined values with default output


FAQ

Q: Can I write raw JavaScript?

A: No. This node uses a structured UI to define logic, which is then compiled to JavaScript internally. You can preview but not directly modify the JS code.

Q: What if the input key doesn’t exist?

A: If “Output Zero if Value Not Found” is enabled, the result will be 0. Otherwise, an error will be returned if error handling is configured.

Q: Can I use nested JSON keys?

A: Yes, dot notation (e.g., device.status) is supported.