ComfyUI Node

Data Temp Get

Read back a session variable during a batch loop

By aidec·Created 2 years ago·Updated 9 months ago· 19
Data Temp Get
    • text
    • image
    • any
    • array_size
    • all_elements
    • status
    var_namemy_var
    data_typetext
    read_modeindex
    array_index0
    default_text

    Data Temp Get is the read half of aidec's little session-variable system - the other half is Data Temp Set, which stashes things. Get pulls them back out. Together they exist because the pack's "loops" are really the same workflow run once per item, so there's no natural way to carry data between iterations. Set writes into ComfyUI's session memory on one run; Get reads it on a later one.

    Like its partner, this is one of the pack's experimental "test nodes" - the README covers the queue and loader nodes properly and waves at the rest. So it's a primitive for building your own multi-pass logic, not a plug-and-play tool. Worth knowing exists; not something a straightforward batch needs.

    How it works

    You give it a variable name and it looks that up in the session store, returning whatever Data Temp Set put there. It handles both plain variables and arrays: with read_mode you can grab a specific index, the first or last element, or everything at once. That last-and-array behavior is what makes it useful at the end of a loop - after you've been pushing results into an array all batch, one Data Temp Get with read_mode set to all hands you the whole collection.

    The inputs that matter

    • var_name - the name to read, and it must match exactly what Data Temp Set wrote under. my_var is the placeholder.
    • data_type - text, image, or any, matching what you stored.
    • read_mode - index, first, last, or all. Pick index for a specific slot, all to pull the whole array.
    • array_index (optional) - the slot, when in index mode.
    • default_text (optional) - a fallback returned when the variable doesn't exist yet, so a first-iteration read doesn't just break.

    Outputs cover every type it might return: text, image, any, plus array_size, all_elements (the whole array in one go), and status. Wire the output that matches your data_type.

    Installing it

    cd ComfyUI/custom_nodes && git clone https://github.com/aidec/Comfyui_TextBatch_aidec, then restart ComfyUI (or ComfyUI Manager → Install via Git URL). No models, no heavy dependencies. Category: TextBatch.

    Where people get burned

    • Name mismatch = empty read. The single most common failure. Get reads by exact name; one typo against what Set wrote and you get nothing (or your default_text) with no error. Keep the names identical.
    • Reading before writing. On the first loop iteration the variable may not exist yet. Set default_text so that first read has something sane to return instead of blowing up downstream.
    • Type has to line up. Store an image, read as text, and you'll get garbage or nothing. Match data_type between Set and Get.
    • It's session state. Values vanish on ComfyUI restart, and they persist between batches until cleared - so a stale read can be last run's leftover. It's experimental scaffolding; verify what you're reading is what you think.

    If you're accumulating results across a batch and need to fish them back out at the end, this is the node. Otherwise, leave it in the drawer.

    CategoryTextBatch

    Inputs (5)

    NameTypeDefaultDescription
    var_nameSTRINGmy_var
    data_typeCOMBOtext3 options: text, image, any
    read_modeCOMBOindex4 options: index, first, last, all
    array_indexoptINT00–10000
    default_textoptSTRING

    Outputs (6)

    NameTypeDescription
    textSTRING
    imageIMAGE
    any*
    array_sizeINT
    all_elements*
    statusSTRING