# Debatch

This function block disables batch processing for the current variable and demultiplexes (demuxes) a list/batch input into separate outputs so downstream blocks receive individual elements.

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

`Batch` This input socket accepts a list or batch of values (for example: a list of images, numbers, shapes or generic items). The block expects the batch to be provided here.

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

`Output 1`\
`Output 2`

These output sockets provide the individual elements extracted from the incoming batch in sequential order. If the batch contains fewer elements than available outputs, remaining outputs will be left at default/empty values. If the batch contains more elements than available outputs, the first elements are provided to the outputs in order.

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

This block has no interactive controls or user widgets.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

* When a valid batch (list) is connected to the `Batch` input, the block splits the batch and emits elements through the output sockets in order.
* If the input is missing or invalid, the block will show an error/invalid state in the UI and provide default outputs to indicate no valid data is available.
* Use this block when you need to turn a grouped list of items into individual streams so other blocks can process each item independently.

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

* Simple demultiplexing of batch/list data into separate outputs.
* Works with any generic data type (images, numbers, shapes, etc.).
* Safe fallback behavior when input is not connected or invalid.

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

1. Provide a batch or list of items to the `Batch` input.
2. Connect downstream blocks to `Output 1` and/or `Output 2` to receive individual elements.
3. If you expect varying batch sizes, add logic or checking blocks downstream to handle missing or extra elements gracefully.

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

* Combine with `Batch Processing` to switch between batched and per-item processing: produce a batch with `Batch Processing` then use this block to process items individually.
* Use `Get Batch Size` or `Get Element` before or after this block to inspect batch length or access specific elements.
* Reassemble processed items using `Batch Concatenation` or `Mux` when you need to create a single batch/list again.
* Pair with image-focused blocks: feed a batch of images into this block, then connect each output to blocks such as `Show Image`, `Image Logger`, `Find Object`, `Object Detection`, or `Mask Detection` for per-image analysis and saving.
* When working with optional values, chain `Exclude Nones` after this block to remove empty elements before further processing.
* If you need to limit or transform the element stream, use it together with `Get Element` and logic blocks (for example: filtering, counters) to control which elements are passed on.

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

* No outputs update: verify that the `Batch` input is connected and contains a list of items.
* Unexpected empty outputs: check the batch size; if it has fewer elements than the number of outputs, some outputs will be empty by design. Use `Get Batch Size` to confirm the incoming batch length.
* Downstream errors: ensure downstream blocks accept the specific element type (image, number, shape, etc.) emitted by this block. Use type-conversion or validation blocks if needed.


---

# 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/data-logic/flow-control/debatch.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.
