Data Memory

This function block keeps a value in memory and optionally updates it when requested. It is useful for preserving the last known data across runs or for freezing a value until an explicit update is provided.

πŸ“₯ Inputs

Generic General input data to store in memory. Can be any data type (numbers, text, image, lists, dictionaries, etc.). Update Data Boolean input that controls whether the incoming data should replace the stored value.

πŸ“€ Outputs

Generic The currently stored value. If never updated, this may be empty/None.

πŸ•ΉοΈ Controls

This block has no additional UI widgets. Behavior is controlled by the two sockets listed above.

🎯 Features

  • Persistent in-flow memory: holds a value across evaluations and only changes when Update Data is true.

  • Accepts any data type on the Generic socket.

  • Simple freeze/unfreeze mechanic: set Update Data to False to freeze the stored value, True to allow updates.

πŸ“ Usage Instructions

  1. Feed the value you want to keep into the Generic input.

  2. Toggle Update Data to True when you want the memory to accept the new input.

  3. Set Update Data to False to freeze the stored value; the block will keep outputting that value until an update is allowed.

πŸ“Š Evaluation

On each evaluation the block checks the Update Data input. If True, it stores the current Generic input and outputs it. If False, it outputs the previously stored value unchanged.

πŸ’‘ Tips and Tricks

  • Use with Is None to detect missing inputs before writing into memory, keeping the stored value safe from accidental None overwrites.

  • Pair with Replace None to provide fallback data when the input is empty, then control writes with Update Data.

  • Combine with Data Read Local / Data Write Local or Data Read Global / Data Write Global for more persistent sharing between different parts of your flow.

  • Use alongside Debug Input to log stored values during development and verify when memory updates happen.

  • When processing batches, coordinate with Batch Processing, Get Batch Size, or Batch Concatenation to control whether memory should store whole batches or individual elements.

  • For logging or export scenarios, feed the block output into CSV Export, Image Logger, or other export blocks to record the preserved data only when a confirmed update occurs.

πŸ› οΈ Troubleshooting

  • If output never changes, ensure the Update Data input is being set to True when you expect an update.

  • If stored value becomes None unexpectedly, check upstream blocks for None outputs and consider using Replace None before writing to memory.

  • If multiple areas of your flow require the same value, prefer the read/write local/global blocks to avoid duplication and ensure consistent updates.

Last updated

Was this helpful?