Array length

Arrays and ranges Pure Generic
Array length
Array
Result

Description

Pure function returning the number of elements in an array. Generic on the element type; type is fixed at design-time when connected. A null array counts as empty and returns 0.

When to use

Use Array length when you need to know how many elements are in an array before deciding what to do next — for example, branching on whether a result set is empty, or calculating an offset for pagination. Because it is a pure generic node, it works with any array type and evaluates lazily when its output is consumed.

Pins

Input pins

Pin Type Default Notes
Array generic[] The array whose length to count. The element type resolves at design-time from the connected source. A null array — for example an optional array field that arrived as JSON null — counts as empty, exactly like leaving the pin unconnected.

Output pins

Pin Type Notes
Result integer The number of elements in the array. 0 for an empty or null array.

Example

Abort the pipeline if a Split result is empty. Wire the Result output of Split into both the Array input of Array length and the Array input of For each. Feed the Result output of Array length into Equals (B set to 0), then connect the Result output of Equals to the Condition input of Branch. The True execution output routes to Fail; the False output lets the For each loop run.

See also