Skip to main content

Subflows

A Sub Flow is a flow inside a flow. It takes the message in, runs its own graph, and hands the message back — so a run of related nodes collapses to a single box on the parent canvas.

A Sub Flow node

Two reasons to reach for one:

  • Readability. Thirty nodes on one canvas is a wall. The same work as four named subflows is a diagram you can read.
  • Reuse. The same subflow can be called from more than one place, so the logic lives once.

Add one from the Flow section of the palette, or by right-clicking the canvas.

An example

The Use Subflows to Check if File Exists template asks for a filename, checks whether it exists, and branches — with each branch's work in its own subflow:

A flow calling two subflows

Call File_Exists and Call File_Does_Not_Exist are the two Sub Flow nodes. Whatever each of them does, the parent canvas does not have to show it.

Going inside

Double-click a Sub Flow node to open it. The message arriving from the parent is injected at the subflow's Begin node, and each output node hands control back.

Once a flow has subflows, the top bar grows a Subflows selector showing how many there are — that is the quick way back out, and between them, without hunting on the canvas.

Outputs

A subflow starts with one output. Add more in the Sub Flow node's properties, and the subflow view gains an output node for each — which is how a subflow reports which of several things happened, not just that it finished.

Subflows make error handling easier

A Catch node selects the nodes whose errors it handles, and picking twenty nodes one at a time is miserable. Group them into a subflow and the Catch node needs to select exactly one thing.

See also