$nodes, output organization) before moving to array processing and validation.
Fundamentals
These patterns apply to most decision graphs.Data flow with passThrough
By default, passThrough is enabled — each node carries forward all previous data plus its own outputs. Disable it when you want to return only the node’s output fields. In the editor, the → icon on a node indicates passThrough is enabled. With passThrough (default):- You want to return only the calculated results (common for final nodes)
- You need to reshape the output structure completely
Self-reference with $
In expression nodes, use$ to reference values calculated earlier in the same node:
$.fieldName.
Referencing previous nodes with $nodes
Use$nodes to access output from any upstream node in your graph. Each node’s output is available by its name.
In expressions:
$nodes in both input conditions and output expressions:
| Customer Tier | Credit Rating | → | Discount |
|---|---|---|---|
'gold' | $nodes.CreditCheck.rating == 'excellent' | 0.20 | |
'silver' | $nodes.CreditCheck.rating in ['good', 'excellent'] | 0.10 |
Node names are case-sensitive and must match exactly. If your node is named “Credit Score” with a space, reference it as
$nodes["Credit Score"].field.Organizing output with outputPath
Use outputPath to structure your output into nested objects instead of flat fields. Without outputPath — all outputs merge at root level:| Node | outputPath | Fields |
|---|---|---|
| Eligibility check | returnStatus | isEligible, code, message |
| Responsibility | resolution | responsibleParty, refundApproved |
resolution.responsibleParty to achieve the same structure.
Array and collection patterns
These patterns handle lists of items and multiple matching rules.Processing arrays with loop mode
When your input contains an array of items that each need evaluation, use loop execution mode. The node processes each array element individually and collects the results. Configuration:| Property | Description |
|---|---|
executionMode | Set to loop to iterate over an array |
inputField | Path to the array to process (e.g., testResults, items) |
outputPath | Where to store the results array |
Loop mode outputs an array at the root level. Without
outputPath, you’d get unusable output like [{ flag: "critical" }, { flag: "abnormal" }]. Always specify outputPath to place results in a named field.executionMode:loopinputField:testResultsoutputPath:testResultspassThrough:true
| Value | Test Type | → | Flag | Condition |
|---|---|---|---|---|
< 3.5 | 'potassium' | 'critical' | 'Hypokalemia' | |
> 200 | 'glucose' | 'abnormal' | 'Hyperglycemia' | |
< 8.5 | 'hemoglobin' | 'abnormal' | 'Anemia' |
Collecting multiple matches
When multiple rules can apply to a single input, use collect hit policy to return all matching rows as an array.| Hit Policy | Behavior | Use when |
|---|---|---|
first | Returns first matching row | Rules are mutually exclusive |
collect | Returns all matching rows as array | Multiple rules can apply |
Collect mode outputs an array at the root level. Use
outputPath to place results in a named field (e.g., discounts.safetyFeatures), otherwise you’ll get [{ percentage: 3 }, { percentage: 2 }] at root.hitPolicy: collect:
| Safety Features | → | Discount % | Description |
|---|---|---|---|
contains($, 'antiTheftSystem') | 3 | 'Anti-theft discount' | |
contains($, 'dashCam') | 2 | 'Dash cam discount' | |
contains($, 'advancedDriverAssistance') | 5 | 'ADAS discount' |
outputPath: discounts.safetyFeatures, the output becomes:
Workflow patterns
These patterns control the flow of your decision graph.Conditional branching with switch nodes
Use switch nodes to route data through different paths based on conditions. A switch node has:- Conditions: Expressions that determine which path to take
- Handles: Output connections for each condition
- Default: Fallback path when no conditions match
hitPolicy: collect on a switch node to execute all matching branches instead of just the first. Results from all branches are merged.
Validation pattern
Validate input early and branch based on validity. Step 1: Validation table — Create a decision table that checks for invalid conditions:| Condition | → | Error | IsValid |
|---|---|---|---|
weight <= 0 | 'Weight must be positive' | false | |
weight > 70 | 'Exceeds max weight' | false | |
length > 200 | 'Exceeds max length' | false | |
| (empty - catch all) | true |
- Valid requests → continue processing
- Invalid requests → return error response directly
Input schema validation
Add a JSON Schema to your input node to validate incoming data structure:Putting it all together
Real decisions often combine multiple patterns. Here’s a loan approval flow:- Validates input structure via schema
- Accumulates scores from multiple evaluation tables
- Collects all applicable rejection reasons
- Branches based on whether any rejections exist
- Returns either approval with rate or rejection with reasons