Elements runtime reference / Runtime store

setVar

Persist a tenant-shared runtime variable immediately during Element execution.

Signatuur

setVar(name, value=None)

Doel

Persist a tenant-shared runtime variable immediately during Element execution.

Aliases and imports

  • setvar

Payloadformaat

Use these fields as the Python call arguments or keyword payload for this helper.

{
  "name": "sync_cursor",
  "value": 12345
}
FieldDescription
nameRuntime variable id.
valueJSON-serializable value to store.

Return payload

12345

Voorbeeld

def run(params):
    cursor = int(getVar("sync_cursor", 0) or 0)
    next_cursor = cursor + int(params.get("rows", 0))
    setVar("sync_cursor", next_cursor)
    return {"cursor": next_cursor}

Scope-notities