> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runchat.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Matching

> How Runchat lines up multiple inputs and runs the node once per matched set. Covers default zip behaviour and the Each / All / Flatten depth controls.

When a node has multiple input parameters, Runchat lines up the data from each one and runs the node once per matched set. This page covers the default heuristics and the **depth** control you can use to override them.

<iframe width="100%" height="400" src="https://www.youtube.com/embed/7AUXPYIZP-g" title="Each vs All data matching explained" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />

<Frame>
  <img src="https://mintcdn.com/runchat/J8Y8DQ43swL1M50L/images/data/data-matching-hero.webp?fit=max&auto=format&n=J8Y8DQ43swL1M50L&q=85&s=68cf422867f8cdd044bea2e03a7f2d2e" alt="Each vs All connection modes shown as different depth values on a parameter" width="1444" height="573" data-path="images/data/data-matching-hero.webp" />
</Frame>

## Default matching heuristics

### Single input, single item

When a node has a single parameter with one item, no matching is needed. The node processes the input and returns a single output.

For example: plug a text input into a prompt and run the node, you get one response.

### Single input, multiple items

When a parameter receives multiple items, the node processes each one and returns a list of outputs in the same shape.

For example: plug two text inputs into the prompt of an Agent node and you get two responses back.

In some cases you might instead want those items joined into a single input. If you write one piece of text describing a style and another describing content, and connect both to a Create node's prompt, you might want to combine them into one image. Concatenate the text first, or use **all** depth to wrap them as a single value.

### Multiple inputs, same number of items

When a node has multiple input parameters and each receives the same number of items, Runchat zips them together: it runs the node with the first item from each parameter, then the second, then the third, and so on.

For example: connect prompt and context lists of equal length to an Agent node and you get one response per prompt-context pair.

### Multiple inputs, different number of items

When parameters have different counts, Runchat zips matching items and reuses the **last** item from each shorter parameter to fill the gap.

For example: write one set of instructions and connect 10 different prompts to an Agent node. Each prompt is paired with the same single instruction.

<Warning>
  Some data types are themselves made up of multiple items. The Context type
  contains multiple messages, and a Message can contain multiple parts.
</Warning>

## Depth: overriding the default

The **depth** setting on each parameter connection controls list behaviour. Hover an input handle to open the connection control.

### Each (depth = 0)

Individual items are passed to the parameter independently of one another. This is the default behaviour.

### All (depth > 0)

Individual items are all passed to the parameter in a single list. Each level of depth adds one layer of nesting. This allows for one-to-many matching, for instance to match a single prompt with multiple reference images.

### Flatten (depth less than 0)

Nested arrays are flattened before being passed to the parameter. Each level of negative depth removes one layer of nesting. This is useful when you want to unwrap grouped results into a flat list.

## Next steps

* [Data Structure](/concepts/data/data-structure): items, lists, and objects
* [Data Types](/concepts/data/data-types): how Runchat casts values between types
* [Loops](/concepts/data/loops): for recursive workflows where a node feeds itself
