# List Operations

This function block provides a collection of common list manipulations in a single, easy-to-use interface. Choose an operation from the dropdown and the block will adapt its inputs and outputs so you can work with lists (create, query, modify, combine, filter and more) without writing any code.

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

The available inputs change dynamically based on the selected operation.

`List` A generic list input used by many operations.

`Element` A single element to append, remove, or search for.

`Index` An integer index for operations like `Get`, `Set`, `Insert` or `Pop`.

`List(s)` When combining multiple lists (`Pair`) this socket accepts a list of lists.

`List (String)` A single text input used by the `Create` method to build a list from a comma-separated string.

(Other input socket names appear as needed by the chosen method.)

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

The outputs are also dynamic and reflect the chosen method.

`List` Returned list after mutation operations (e.g., append, extend, remove).

`Filtered List` Result of a filter operation.

`Element` An individual element returned by `Get`, `Min`, `Max`, etc.

`Size` Length returned by the `Len` method.

`Index` Index of an element for the `Index` method.

(Additional output sockets appear depending on the method selected.)

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

`Select a method` A dropdown with a small action button. Choose the desired list operation (examples: append, extend, filter, create, len, min, max, slice, pair). The block updates sockets automatically when you change this selection.

`Info` A small text area that displays usage hints for the selected method (for example, reminding you that filter conditions must be a boolean list of the same length).

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

* Dynamic sockets: inputs and outputs are created or removed automatically when you pick a method, keeping the interface clean.
* Wide operation set: supports creation, querying, modification and combining of lists (append, extend, insert, pop, remove, filter, slice, sort, reverse, sum, min/max, index, set, pair, and more).
* Built-in validation: warns when indexes are out of bounds or when list sizes do not match for operations like filter or pair.
* Create from text: build a list quickly from a comma-separated string using the `Create` method.

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

1. Choose a method using the `Select a method` control.
2. The block updates its input and output sockets to match the selected operation.
3. Provide the required inputs by connecting other blocks or entering values.
4. When the scenario runs, the block performs the chosen list operation and provides the result on the specified output sockets.
5. If inputs are invalid (e.g., mismatched sizes, invalid index), the block shows an error message and returns a safe fallback where appropriate.

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

1. Open the block and pick the desired operation from `Select a method`.
2. Inspect the displayed `Info` text for quick guidance about that method.
3. Connect the appropriate inputs (for example, connect a list and an element for `Append`).
4. Run the scenario and read results from the output sockets that appear for the chosen method.

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

`Create` Use with a `String Input` block to let users type comma-separated items, then convert them into a list automatically.

`Filter` and `Filter Inverse` When filtering data, produce the condition list with logical blocks such as `Equals`, `Greater`, or `Less` and then feed that boolean list into this block to extract matching items.

`Pair` Useful to combine parallel data streams. Pair works well with outputs from `Object Detection` or `Object Detection - Custom` when you have parallel lists (for example, positions and sizes) and want them zipped together for downstream logging or export.

`Get`, `Index`, `Min`, `Max` Combine with `Get Element`, `Exclude Nones`, or `Replace None` to sanitize inputs before querying or aggregating list values.

`Sum`, `Len` Use with `Scope` or `CSV Export` to collect numerical summaries for plotting or logging.

`Slice` When processing a batch of items, combine with `Debatch` or `Batch Processing` to iterate and process sublists.

General

* Use `Data Memory` when you want to hold a list steady until an explicit update arrives.
* Create logging or export pipelines: after restructuring lists here, send results to `Data to JSON` or `CSV Export` for external storage.
* When building lists from textual sources, use `Find Substring` and `String Merge` to prepare strings before using the `Create` method.

(have these related blocks ready in your workspace to build robust pipelines)

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

`Filter` and size mismatch If you see an error about unequal sizes, make sure the condition list has the same number of elements as the data list. Use `Get Batch Size` or `Len` to diagnose sizes.

`Index out of range` For methods that take an index (`Get`, `Set`, `Insert`, `Pop`), verify index bounds before connecting. Use `Len` or `Get Batch Size` to obtain valid ranges.

`Unexpected types` Some operations expect numeric or comparable items (for `Sum`, `Min`, `Max`, `Sort`). Use `Replace None` and `Exclude Nones` to clean the list first.

`Creating lists from text` When using `Create`, ensure items are comma-separated. Extra whitespace is trimmed automatically, but non-numeric tokens remain strings — double-check with `Find Substring` or `String Operations` if you need further parsing.

If you run into persistent issues, check the `Info` hint for the selected method — it often contains quick, method-specific guidance.


---

# 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/list-operations.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.
