# Get Element

This function block extracts a single item from a provided list (batch) by using an index value. It is useful when you need to pick one element from a collection and feed it into downstream blocks.

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

`Batch` A list or batch of values (images, numbers, texts, etc.) from which an element will be retrieved.

`Index` The index position (zero-based) indicating which element to return from the batch.

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

`Generic` The selected element from the batch. The returned type matches the element type inside the input batch.

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

This function block has no interactive widgets. It works by reading the provided input sockets each evaluation step.

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

* Simple and direct extraction of one element from a list or batch.
* Works with any generic data type carried inside the batch (images, numbers, strings, shapes, etc.).
* Designed for straightforward integration in flow where single-item processing is needed.

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

1. Provide a list or batch to the `Batch` input.
2. Provide the element position (zero-based) to the `Index` input.
3. The block outputs the element at the requested position on its `Generic` output.
4. If you provide a batch with dynamic length, ensure the index value is valid to avoid unexpected results.

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

On each run, the block reads the current `Batch` and the `Index` values, then forwards the element at that index to the output. If the index refers to a single value, a single element is returned; when combined with batching flow control, it can be used to select specific items for further processing.

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

* Use `Batch Processing` before this block when you want to feed grouped or streamed data and reduce memory usage.
* Combine with `Debatch` to convert a batch into individual items and then use `Get Element` to pick a specific item from that stream.
* Use `Get Batch Size` to verify the batch length before selecting an index; this prevents out-of-range selections.
* Use `Is None` and `Replace None` after this block to handle missing values gracefully.
* Use `Data Memory` to freeze or cache a batch and keep the same data available while experimenting with different index values.
* Use `Debug Input` to inspect the batch or index when results are unexpected.
* When building indexed image pipelines, combine with visualization blocks like `Show Image` to preview the selected image element.

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

* If you receive unexpected or empty output, confirm the `Batch` actually contains elements and that `Index` is within the valid range (0..length-1).
* If the pipeline sometimes supplies None values, use `Is None` or `Replace None` to guard downstream processing.
* For workflows with changing batch sizes, always check `Get Batch Size` before using `Index` to avoid invalid access.


---

# 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/data-operations/get-element.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.
