Zum Inhalt springen
Agentic Workflowdocs
v0.8.2Kostenlos installieren

knoten / builtin / flow

Set Variable

Remember a named value for the rest of the current run

Ablauf ErweiterungWeb-App

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Remember a named value for the rest of this run, so any later node can read it as {{ $run.name }}.

Set Variable stores a value under a name. Any node that runs after it can read the value with {{ $run.name }} in any field, with no edge to this node. That lets you carry a value to a node far away on the canvas, or build up a total or a list across the passes of a Loop.

The Operation decides what happens to the variable:

  • Set: store the Value, replacing what was there.
  • Add to number: add the Value to the number already stored. A variable that is not set yet starts at 0, so you don’t need to set it first.
  • Append to list: add the Value to the end of a list. A variable that is not set yet starts as an empty list.
  • Delete: forget the variable.

Variables last for one run and are gone when it ends. To remember something between runs, use Data Store.

  • Hand a value (a page cursor, a user name) to a step much further on without wiring it through every node in between.
  • Count items or add up amounts over a Loop.
  • Collect results from each pass of a Loop into one list.
EinstellungTypWas es bewirkt
Operation ChoiceWhat to do to the variable. Options: Set, Add to number, Append to list, Delete. Standard: Set
Name TextName to store the value under. Read it later as {{ $run.name }}.
Value ValueThe value to store.
Pass The Item Through ToggleEmit the incoming item unchanged, so this node can sit inline. Standard: On
  • Name may contain letters, digits, _ and $, and must not start with a digit, for example cursor or total_price.
  • Value is usually an expression such as {{ $input.nextPage }}. For Add to number it must be a number (or text that is a number, like 5).
  • Output

With Pass The Item Through on (the default), the incoming item goes out unchanged, so you can drop Set Variable in the middle of a chain. With it off, the item is replaced by a summary: name, value (what the variable now holds) and operation.

None. This node needs no connection and has no slots for other nodes.

Count the links on a page that point to PDFs:

  1. Get All Link with Output field name links reads the links of the open page.
  2. Split Out with Field To Split Out links makes one item per link.
  3. Filter keeps items where {{ $input.links }} (String) Ends With .pdf.
  4. Set Variable with Operation Add to number, Name pdfCount, Value 1. It runs once per kept link.
  5. A later Show Notification shows Found {{ $run.pdfCount }} PDFs.
  • “Variable “x” has not been set at this point in the run.“ A node read {{ $run.x }} before Set Variable ran. Only nodes downstream of Set Variable are sure to run after it; a node on a parallel branch may run first. Connect Set Variable upstream of the reader. The canvas also warns you when a read may come before the write.
  • “Variables only exist while a workflow is running.” You ran the node on its own. Run the whole workflow.
  • “… cannot be used as a variable name.” Use only letters, digits, _ and $, not starting with a digit.
  • “Cannot append to “x” because it holds …, not a list.“ The variable was set to something else earlier. Use a new name, or Delete it first.
  • “The amount to add is not a number.” With Add to number, the Value must be a number.
  • Get Variable: turn a stored value back into items.
  • Loop: repeat steps while updating a variable.
  • Data Store: remember values between runs.
  • Expressions: how $run and other expressions work.
Seite bearbeiten

Zuletzt aktualisiert:

Was this page useful?
Aria zu Set Variable fragen