Skip to content
OpenNodeFlow.DocsOpen beta ↗
Agent guide ↗
Docs/Library & integrations

Logic and data selection

Compose Boolean decisions, preserve falsy values and distinguish selecting data from routing execution.

23 Oct 2026 · 9 min read
Markdown ↗

The logic/utility addition supplies reusable Boolean, comparison, absence/default, selection, routing, text, list and record helpers. These are pure operations: they need no provider credential and are useful as synthetic fixtures before external actions are added.

Route control deliberately#

Wire a comparison's result into Boolean Branch condition. Connect true and false control outputs to the corresponding downstream Execute sockets. Only the selected control emits; next stays inactive. Switch Text Cases emits exactly one of four configured case controls or otherwise. Empty configured strings are valid; duplicate normalized cases fail before emission.

Select nodes choose a data value after their dependencies finish and require both candidates. Selecting one result does not prevent an upstream provider action from executing. Put the action behind a control branch when execution itself must be conditional.

Missing, null and falsy#

Defaults replace absent/null values, retaining false, zero, empty string, empty array and empty record. Inspect JSON Presence exposes emptiness separately, optionally trimming whitespace. Do not use truthiness as a missing-value detector when false/zero/empty are legitimate domain values.

Named nullable scalar contracts and canonical JSON Value/Record/List identities keep their exact pins. An optional socket is not automatically nullable. Wire only optional decode outputs known to exist on the selected branch; otherwise a dependent node can legitimately skip.

Comparison and bounded transformations#

JSON Deep Equal ignores record-member order, respects array order and scalar types, and does not coerce string/number values. JavaScript numeric comparison uses binary floating point. For exact integer IDs or money, retain appropriate strings or a documented decimal representation rather than relying on floating-point equality.

Text slicing uses UTF-16 code units and can split a surrogate pair. Literal replacement is not a regular expression and does not expand replacement-dollar sequences. Record construction rejects duplicate keys and defines special own keys safely. JSON Record Entry stores its value under the actual JSON member value while its codec exposes the data socket.

Typical logic bounds are 1 MiB serialized JSON, depth 64, 20,000 values, 10,000 list items and 200,000 UTF-16 units per string/key. Utility text is bounded to 1 MiB; record keys to 4,096 code units. Read each selected node's exact bounds rather than assuming every helper is identical.

Operations#

  • Boolean AND: Combine two required boolean sockets without truthiness conversion. Both inputs must already be available; this node does not short-circuit upstream execution. No configuration. Example: true AND false → false.
  • Boolean OR: Combine two required boolean sockets without truthiness conversion. Both inputs must already be available; this node does not short-circuit upstream execution. No configuration. Example: true OR false → true.
  • Boolean XOR: Combine two required boolean sockets without truthiness conversion. Both inputs must already be available; this node does not short-circuit upstream execution. No configuration. Example: true XOR true → false.
  • Boolean NOT: Invert one required boolean. No coercion or configuration. Example: value false → result true. Use the result with Boolean Branch to choose a control path.
  • Boolean List Reduce: Reduce a named Boolean List with configuration operation: all (default), any, none or exactlyOne. Return result, trueCount and count. Empty input produces all=true, none=true, any=false, exactlyOne=false. At most 10000 members. Example: [true,false,true] with exactlyOne → false, trueCount 2, count 3.
  • Compare Numbers: Compare two finite numeric input sockets. Configure operation equal (default), notEqual, less, lessOrEqual, greater or greaterOrEqual. No string/boolean conversion or epsilon tolerance is applied; -0 equals 0. Example: left 80, right 80, greater → false. JavaScript binary floating point is unsuitable for exact decimal accounting.
  • Number In Range: Test finite value against socket-provided minimum and maximum. Configuration includeMinimum and includeMaximum default true. Reversed bounds fail instead of swapping. Equal bounds contain that number only when both endpoints are included. Example: value 10, minimum 0, maximum 10 → true; includeMaximum=false → false.
  • Compare Text: Compare two text sockets with operation equal (default), notEqual, contains, startsWith or endsWith. ignoreCase defaults false; true applies JavaScript Unicode toLowerCase, without locale collation or normalization. No trimming. Empty search text matches contains/startsWith/endsWith. At most 200000 UTF-16 code units per input. Example: left "Ready", right "ready", ignoreCase=true → true.
  • JSON Deep Equal: Compare explicit dynamic JSON values structurally, without configuration. Object member order is ignored; array order, property presence, null and scalar types matter. -0 equals 0. Examples: {a:1,b:2} equals {b:2,a:1}; [1,2] does not equal [2,1]; 1 does not equal "1". Validate both entire inputs before comparison, even if they differ at the root. Bounds apply independently per input.
  • Inspect JSON Presence: Inspect an optional dynamic JSON value without conflating false/0 with empty. present indicates socket presence; isNull is true only for present null; isEmpty is true for absent, null, empty string/list/object. kind is absent/null/string/number/boolean/array/object. size is emitted only for strings (UTF-16 length), arrays (items) or objects (own members). trimText defaults false and only affects string emptiness/size; input is preserved. Examples: false → present true/isEmpty false/kind boolean; omitted → present false/isNull false/isEmpty true; " " with trimText=true → size 0.
  • Default JSON Value: Return fallback only when optional value is absent or null. Empty string/list/object, false and 0 are retained. fallback is required, may itself be null, and is a normal eager data dependency. No configuration. Examples: value 0/fallback 10 → 0, usedFallback false; value null/fallback "unknown" → "unknown", usedFallback true. Selected JSON value is bounded.
  • First Non-Null JSON Value: Select the first non-null member of a dynamic JSON List. Return zero-based index and found=true; no candidate returns value null, found=false, index=-1. Empty strings/objects/lists, 0 and false count as candidates. No configuration. Validate the entire list before selecting; list/JSON bounds apply. Example: [null,false,"later"] → value false,index 1.
  • Select JSON Value: Choose between two required json value sockets using strict boolean condition. No configuration. Both values must be available before this node runs: selection is eager and does not suppress either upstream branch or its effects. Use Boolean Branch for execution gating. Example: condition=false returns whenFalse, including an empty string, false, 0 or JSON null when that socket type allows it. Selected value is validated and bounded.
  • Select Text: Choose between two required text sockets using strict boolean condition. No configuration. Both values must be available before this node runs: selection is eager and does not suppress either upstream branch or its effects. Use Boolean Branch for execution gating. Example: condition=false returns whenFalse, including an empty string, false, 0 or JSON null when that socket type allows it. Selected value is validated and bounded.
  • Select Number: Choose between two required number sockets using strict boolean condition. No configuration. Both values must be available before this node runs: selection is eager and does not suppress either upstream branch or its effects. Use Boolean Branch for execution gating. Example: condition=false returns whenFalse, including an empty string, false, 0 or JSON null when that socket type allows it. Selected value is validated and bounded.
  • Select Boolean: Choose between two required boolean sockets using strict boolean condition. No configuration. Both values must be available before this node runs: selection is eager and does not suppress either upstream branch or its effects. Use Boolean Branch for execution gating. Example: condition=false returns whenFalse, including an empty string, false, 0 or JSON null when that socket type allows it. Selected value is validated and bounded.
  • Default Nullable Text: Unwrap the existing named Nullable String v1 into primitive string with a required fallback socket. Absence/null selects fallback; empty text, false and 0 remain values. No coercion or configuration. Example: value null → fallback; a present empty string is retained. fallback is an eager dependency. This deliberately uses the existing nullable type identity so its decoder/producer sockets connect without duplicate equivalent types.
  • Default Nullable Number: Unwrap the existing named Nullable Number v1 into primitive number with a required fallback socket. Absence/null selects fallback; empty text, false and 0 remain values. No coercion or configuration. Example: value null → fallback; a present 0 is retained. fallback is an eager dependency. This deliberately uses the existing nullable type identity so its decoder/producer sockets connect without duplicate equivalent types.
  • Default Nullable Boolean: Unwrap the existing named Nullable Boolean v1 into primitive boolean with a required fallback socket. Absence/null selects fallback; empty text, false and 0 remain values. No coercion or configuration. Example: value null → fallback; a present false is retained. fallback is an eager dependency. This deliberately uses the existing nullable type identity so its decoder/producer sockets connect without duplicate equivalent types.
  • Boolean Branch: Route a strict boolean socket to exactly one of true or false while optionally passing through dynamic JSON value. No configuration or truthiness conversion. Example: condition false/value 0 → passed false,value 0, only false emitted. next is never selected. Connect the selected control output to each branch Execute socket; a data wire alone is not gating. Multiple incoming control routes are OR, not AND. A value absent on input stays absent on output. Selected data is bounded.
  • Switch Text Cases: Match a text socket against up to four configured strings case1, case2, case3 and case4. Unconfigured cases are inactive; empty text is a valid configured case. caseSensitive defaults true; false applies JavaScript Unicode toLowerCase without locale collation/normalization. Duplicates after normalization fail before any route emits. Exactly one case1..case4 or otherwise control emits; next never emits. index is 1..4 on match and 0 otherwise, with matched flag and unchanged value. Example: case2="ready", value="ready" → case2,index 2. All cases absent selects otherwise. Max 200000 UTF-16 code units per input/case.
  • Text Slice By Index: Slice text from inclusive start to exclusive optional end (default text.length). Output text. Indices count UTF-16 code units; may split surrogate pairs, not graphemes. No configuration. Example text="hello", start=1, end=4 → "ell". Empty slices return ""; negative, fractional or out-of-range indices fail.
  • Text Replace Literal: Replace literal non-overlapping occurrences of search in text with replacement. Output text and replacement count. Config all defaults true; false replaces first only. Case-sensitive UTF-16 search; no regular expressions or $ replacement syntax. Example text="a.a", search=".", replacement="$&" → "a$&a", count=1. Empty search fails; no matches returns unchanged text.
  • JSON List Slice: Slice JSON items by inclusive start, exclusive optional end (default length). Output items and resulting count. No configuration. Generic values/null/order preserved. Example [0,false,null], start=1 → [false,null], count=2. Empty slices work; negative, fractional or out-of-bounds ranges fail.
  • JSON List Concatenate: Concatenate left then right JSON lists into items and resulting count. No configuration. Example [0,false] plus [null] → [0,false,null], count=3. Preserves duplicates, order and nested values; no flattening or de-duplication. Combined list must fit bounds.
  • JSON Record To Entries: Expand record own enumerable fields to typed entries plus count. No configuration. JavaScript own-key order is retained (integer-like keys precede other keys). Example {a:0,b:false} → [{key:"a",value:0},{key:"b",value:false}], count=2. Empty object produces []. Inherited fields are excluded.
  • JSON Record From Entries: Build record from typed entries. No configuration. Duplicate literal keys fail rather than overwrite. Own-property definition safely preserves keys such as proto and constructor without prototype mutation. Example [{key:"x",value:null}] → {x:null}. Empty entries produce {}. Integer-like keys enumerate according to JavaScript object rules.

Functional codecs round-trip Boolean Lists, record entries and typed entry lists. For list codecs, inspect item/rest/index/count and the empty-list behavior. See utilities for network/formats/file helpers and setup before attaching provider effects.

Source provenance

Reviewed against maintained source and topic documentation on 23 October 2026. This is a source snapshot; installed versions and provider access may differ.

  • ../OpenNodeFlow-Library/docs/LOGIC-UTILITIES.md
  • docs/LIBRARY-LOGIC.md
Type to search the documentation.
↑ ↓ to navigate · Enter to openAgent map ↗