Data Write Global

This function block stores incoming data into a shared global storage accessible by other blocks in the same scenario. It is useful when you need to pass values across different parts of a scenario, create simple cross-flow communication, or implement loops that require shared state. Note that using global storage can introduce timing or integrity limitations β€” it does not guarantee strict data flow ordering.

πŸ“₯ Inputs

Generic The data to be stored in the global storage under the chosen key.

πŸ“€ Outputs

This function block does not produce any outputs.

πŸ•ΉοΈ Controls

Key A text field where you enter the name used to store the incoming data in global storage. Use a clear, unique key to avoid unintended overwrites.

🎯 Features

  • Persistent cross-block storage within the running scenario, enabling sharing of values, images, lists, or any generic data type.

  • Works well for creating communication points when direct socket connections are impractical (for example, when implementing loops).

  • Simple write-only interface: when data is provided to the input, the block writes it to global storage under the chosen Key.

  • Lightweight and fast for small amounts of data.

βš™οΈ Running mechanism

  • When the block receives a value on the Generic input, it stores that value in the scenario's global storage using the text entered in the Key control.

  • The block itself does not return a value; other blocks can retrieve the stored data by reading the same Key from global storage.

  • Because global storage is shared, writes can overwrite previous values with the same key. Timing between writes and reads depends on the flow of the scenario.

πŸ“ Usage Instructions

  1. Enter a unique name into the Key control.

  2. Provide the data you want to share into the Generic input.

  3. Use a corresponding read block to access the stored data elsewhere in the scenario.

πŸ’‘ Tips and Tricks

  • Use Data Read Global to retrieve values written by this block in other parts of your scenario.

  • For local-only communication inside a tight loop, prefer Data Write Local and Data Read Local to avoid broad shared-state side effects.

  • To inspect what is being written during development, connect a Debug Input block or use CSV Export / Data to JSON to log content.

  • When storing complex structured data (lists, dictionaries), consider converting it to a serializable format with Data to JSON before writing, and parse it after reading.

  • If you need to save images or many frames, combine this block with Image Logger or Multi Image Write rather than keeping large image batches in global memory.

  • Avoid key name collisions by adopting a naming convention (for example, prefixing with a module name or purpose).

βœ… Best practices

  • Choose descriptive keys and document them in your scenario so other users know what each key contains.

  • Keep global writes minimal and infrequent for better predictability.

  • If multiple writers may update the same key, design a handshake or versioning pattern (for example, write a timestamp or counter alongside the data) so readers can determine freshness.

πŸ› οΈ Troubleshooting

  • If a reader cannot find expected data, confirm the exact Key text matches between writer and reader.

  • If values appear stale or overwritten unexpectedly, check other parts of the scenario for writes to the same key and consider using local storage instead.

  • If you encounter inconsistent behavior in loops, try restructuring the flow to read immediately after a write or use explicit flow-control blocks to synchronize operations.

Last updated

Was this helpful?