Skip to content

Filter node

The Filter node takes an array and keeps only the items that match a condition — the piece ForEach was missing. Where ForEach runs a branch for every item, Filter produces a new, shorter array you can loop over, count, or return.

Component id: flowrunner/filter.

How it works

Filter reads a source list (a dotted reference to an array), tests each element against a keep-when condition, and writes the survivors to a result variable.

For each element it binds the current item under an item variable (default item) so the condition can read it — exactly like ForEach:

  • a plain object element is exposed as-is, so the condition reads item.field;
  • a scalar element (string / number / boolean) is wrapped as { value, index }, so the condition reads item.value.

The condition uses the same grammar as the If node: a comparison (item.price > 10, item.status == 'open') or a structured expression built in the inspector. An element is kept when the condition is true. A per-item evaluation error simply drops that element; a source that isn't an array yields an empty list.

How the result is stored

The kept elements are always stored as an array wrapped in value:

text
refs.<resultVar> = { value: [ ...kept elements... ] }

Read the filtered array back as <resultVar>.value — for example, feed it straight into a ForEach whose collection is filtered.value.

Config

FieldRequiredDescription
collectionYesDotted reference to the source array, e.g. start.items or response.body.
itemVarNo (default item)The variable each element is bound to while the condition runs.
conditionYesA keep-when test in the If grammar. Objects: item.field; scalars: item.value.
resultVarNo (default filtered)The variable the kept array is written to (as { value: [...] }).

Ports

Filter has a single next port — it filters and continues.

Examples

Keep only the orders over £10:

text
Filter  collection: start.orders   condition: item.total > 10   resultVar: bigOrders
# → refs.bigOrders = { value: [ { total: 20 }, { total: 15 } ] }
# read later as: bigOrders.value

Filter a list of numbers, then loop over what's left:

text
Filter   collection: start.scores   condition: item.value >= 50   resultVar: passing
ForEach  collection: passing.value  itemVar: student

TIP

Filter never mutates the source array — it writes a fresh one. The original stays available under its own reference.

See also

FlowRunner — the no-code platform for small businesses.