> For the complete documentation index, see [llms.txt](https://docs.augelab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.augelab.com/function-blocks/blocks-reference/data-logic/referencing/data-write-local.md).

# Data Write Local

This function block saves incoming data into a local scenario storage so other blocks can read it later. Use it when you need to persist a value (image, number, text, list, etc.) across different parts of your scenario or to create simple feedback loops. Note: this block enables loops but does not guarantee data flow ordering or integrity — use with care.

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

`Generic` This socket accepts any data type to be stored.

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

This function block does not produce outputs.

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

`Data Key` Enter a string key to identify the value you store. Use clear, unique names so other blocks can read the right data.

* Autocomplete helps pick existing local keys when available.
* Keys are plain text labels; matching must be exact when reading.

## ⚙️ How it works <a href="#how-it-works" id="how-it-works"></a>

* When the block runs, any value present on the `Generic` input is saved under the chosen `Data Key` in the local scenario storage.
* If no data is provided, nothing is written.
* The saved value stays available to other blocks that read the same key until it is overwritten or the scenario ends.

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

* Store any data type (images, numbers, lists, text).
* Simple persistent storage inside the running scenario.
* Autocomplete for existing local keys to reduce typos.
* Designed for quick sharing of intermediate results and enabling local loops.

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

1. Type a descriptive name into `Data Key` (for example "last\_detection" or "calibration\_matrix").
2. Connect a producing block to the `Generic` input so a value is provided at runtime.
3. Use a corresponding read block (for example `Data Read Local`) elsewhere in the scenario to retrieve the value by the same key.

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

* Use clear key names (for example include the type or source: "camera1\_frame", "threshold\_value") to avoid accidental overwrites.
* To read back the stored value inside the same scenario use `Data Read Local`. To share data across scenarios use `Data Write Global` and `Data Read Global`.
* Combine with `Data Memory` when you want a value to remain unchanged until explicitly updated.
* If you want to export stored structured data later, write it into a friendly format using `Data to JSON` and then save with `CSV Export` or other export blocks.
* Use `Debug Input` to quickly inspect what is being written under a given key while building your flow.
* Use `Replace None` before writing if you want to ensure a fallback value is stored when the input is empty.

## ✅ Best practices <a href="#best-practices" id="best-practices"></a>

* Avoid reusing the same key for unrelated data types (e.g., image vs. number) — prefer distinct keys.
* Keep keys human-readable to make debugging and maintenance easier.
* When building feedback loops, be explicit about which blocks read and write the same key to reduce ambiguity.

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

* No value found when reading: confirm the exact spelling of the `Data Key` in both write and read blocks.
* Unexpected value type: check which block last wrote to the same key and ensure consistent data types.
* Difficulties tracing data: add `Debug Input` or a temporary `Data Read Local` connected to a visible output to inspect stored values.
* Race conditions / ordering issues: remember this local store does not guarantee execution order — design flow accordingly or restructure using clearer control/flow blocks.
