Set Variable
Set Variable
Section titled “Set Variable”Type: set-variable · Package: Core Activities v1.0.0
Assigns a value to a variable. It is the activity with which you create or update data by hand within the flow: initialize a counter, accumulate a text, save the result of a calculation, or change the value of a variable depending on what happens.
Unlike activities that store their result in an Output field, Set Variable exists precisely to assign a value that you define using an expression.
How it works
Section titled “How it works”You indicate the name of the destination variable and the value. When executed, it evaluates the value (literal or expression =) and saves it in that variable, overwriting whatever it had. If the variable does not exist, it is declared automatically.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
name | nombre de variable | The variable to assign. A valid name (no spaces or accents). |
value | expression | The value to save. Literal or expression =. |
Optional parameters
Section titled “Optional parameters”Ninguno.
Examples
Section titled “Examples”Initialize a counter and then increment it (typical pattern inside a loop):
Set Variable name = contador value = 0...For Each items = = facturas itemVariable = factura └─ activities: Set Variable name = contador value = = contador + 1Accumulate a total:
Set Variable name = total value = = total + num(fila["Monto"])Build a flag based on a condition:
Set Variable name = requiereRevision value = = total > 1000000Common errors
Section titled “Common errors”| Symptom | Causa | Solution |
|---|---|---|
The value is saved as text =a+b | You forgot that value needs the = to evaluate | Prepend = so that it is an expression, not a literal |
Variable no declarada en modo estricto | The name does not match an existing variable | Check the exact name (case sensitive) |
Related activities
Section titled “Related activities”- Variables — how they are declared and their scope.
- Expressions — what you can calculate in
value.