# Demux

This function block splits a single grouped input into multiple separate outputs. Use it when you have a list or batch of items and want to access each element individually as separate outputs.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`In` Accepts a grouped input (list/batch) on a single socket. The socket accepts multiple items.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Out 1`, `Out 2` ... Each output socket provides one element of the input list. The number of outputs can be changed to match the size of the input list you want to split into.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`Output size` Choose how many outputs the block should provide. The dropdown adjusts the visible output sockets dynamically.

## 🎨 Features <a href="#features" id="features"></a>

* Dynamic output count: change how many outputs are available without replacing the block.
* Preserves input order: items are forwarded to outputs in the same sequence they arrive.
* Supports generic data: works with images, numbers, shapes, or any other generic values provided by previous blocks.

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. Provide a grouped list or batch to the `In` socket.
2. Set `Output size` to the number of elements you expect to split into.
3. Use the separate outputs to feed downstream blocks that need individual items.

## 📊 Evaluation <a href="#evaluation" id="evaluation"></a>

When the block runs, it reads the grouped input and places each element onto a corresponding output socket. If the input is shorter or longer than the configured output count, handle the mismatch with downstream logic or adjust the `Output size` accordingly.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* To recombine split items back into a single flow, pair this block with the `Mux` block.
* To access a single element from a list before or after demultiplexing, use the `Get Element` block.
* Use `Batch Processing` before demultiplexing when processing large lists to reduce memory usage.
* After processing individual items you can merge them back using `Batch Concatenation`.
* If you need to iterate over each item and break them back out of a batch, consider combining with `Debatch`.
* Store or freeze intermediate results with `Data Memory` when you need stable outputs for downstream steps.

(hint: pick only blocks from the available list when combining — e.g., `Mux`, `Get Element`, `Batch Processing`, `Debatch`, `Batch Concatenation`, `Data Memory`.)

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* No outputs populated: ensure a valid grouped input is connected to `In` and that `Output size` is set to the expected number.
* Missing or extra elements: confirm the input length matches the configured `Output size` or add logic downstream to handle variable lengths (for example with `Get Element` or `Replace None`).
* Unexpected data types: verify upstream blocks produce the data type you expect; use type-conversion or validation blocks if necessary.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augelab.com/function-blocks/blocks-reference/data-logic/logic/demux.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
