Skip to main content

Documentation Index

Fetch the complete documentation index at: https://hypha-docs.plinqx.app/llms.txt

Use this file to discover all available pages before exploring further.

The CHOICE node evaluates conditions and routes flow execution to different branches based on the result.

Overview

CHOICE nodes enable:
  • Conditional Logic: Branch based on expressions
  • Multiple Branches: Define multiple condition branches
  • Default Branch: Fallback branch when no conditions match
  • First Match Wins: First matching condition executes

How It Works

1

Evaluate Conditions

CHOICE node evaluates each branch condition in order.
2

First Match

First condition that evaluates to true executes.
3

Execute Branch

Flow continues down the matched branch.
4

Default Branch

If no conditions match, default branch executes (if configured).

Condition Syntax

Conditions use JavaScript expressions with variable substitution:
  • Variable Access: {{node.field}} → replaced with actual value
  • JavaScript Operators: ==, !=, >, <, >=, <=, &&, ||
  • Functions: String, number, and array functions available

Example Conditions

{{START.status}} === "active"
{{action.response.statusCode}} >= 200 && {{action.response.statusCode}} < 300
{{START.items.length}} > 0
{{START.method}} === "POST" || {{START.method}} === "PUT"

Configuring Branches

1

Add Branch

Click “Add Branch” in CHOICE node configuration.
2

Set Condition

Enter condition expression.
3

Label Branch

Optionally label the branch for clarity.
4

Configure Default

Optionally set a default branch.

Branch Output

CHOICE node provides output about which branch was taken:
{
  "matchedBranch": "branch_id",
  "matchedLabel": "Branch Label",
  "condition": "{{START.status}} === 'active'"
}
Access in subsequent nodes:
{{choice_node.matchedBranch}}
{{choice_node.matchedLabel}}

Best Practices

Order Matters

Place most specific conditions first

Use Default

Always include a default branch

Clear Labels

Label branches clearly for readability

Test Conditions

Test all branch conditions thoroughly

Common Patterns

Status-Based Routing

Branch 1: {{START.status}} === "success" → Success path
Branch 2: {{START.status}} === "error" → Error path
Default: → Unknown status path

Value Range Checking

Branch 1: {{START.count}} > 100 → High volume path
Branch 2: {{START.count}} > 10 → Medium volume path
Default: → Low volume path

Method-Based Routing

Branch 1: {{START.method}} === "GET" → Read path
Branch 2: {{START.method}} === "POST" → Create path
Default: → Update/Delete path

Next Steps

PARALLEL Node

Execute multiple branches in parallel

FOREACH Node

Loop over arrays