Once you understand
where a variable is visible, using one is the same everywhere in Buttons: browse for it, insert it, and optionally transform it with an expression.
Before you begin#
- A variable already defined, see the scope-specific steps below if you haven't created one yet.
Create a Self or Parent variable#
- Select the button or section that should hold the variable.
- Open its Variables inspector section.
- Under Self, add a variable and give it a value: it's visible only inside this element.
- Under Parent, add a variable if this element needs to expose a value to whatever contains it: it becomes a Self variable of the parent instead of this element.
Create a Position Variable#
- Open the position's own configuration, or any element's inspector inside it.
- Add a Position Variable and choose its type.
- Set its value for this position. Each position that uses this variable needs its own value set independently.
To use a Position Variable to swap which connection a control targets, set its type to Connection, then use the Set Position Variable Internal Action on a button to change it at runtime.
Create a Workflow Variable#
- Open Workflow, and open or create a Workflow.
- Drag a Workflow Variable node onto the canvas.
- Give it a Variable Key: this is the individual variable's own key, separate from the Workflow's own Variable Key (which defaults to the Workflow's name and is used for other purposes on the Workflow itself).
- Set Type: String, Number, or Boolean.
- Set an Initial Value, or turn on Persist Value to keep the variable's current value across a restart instead of resetting to its initial value.
- Select Apply.
Change its value from anywhere using the Set Workflow Variable Internal Action.
Find and insert a variable#
Most text fields in the inspector have a small folder icon at the end. Selecting it opens the variable browser, organized by scope: Self, Parent, Position, and any Connection or Workflow variables available to you. Select a variable to insert it as a label or as an action's value.
When a variable's raw value isn't quite what you need, use an expression instead of the variable directly:
- Open the expression editor from the same field you'd insert a variable into.
- Reference the variable inside the expression, and combine it with functions as needed. For example,
concat combines several strings and variables into one value.
The expression editor suggests available functions and variables as you type, so you don't need to remember exact syntax.
If you get stuck#
What you see | What to try |
|---|
Two variables seem to conflict, or one shows the wrong value. | Check their scope: a Self variable in one element and an identically-named Self variable in another are never actually the same variable. |
A Position Variable shows a different value than you expect. | Confirm you're looking at the right position: the definition is shared, but each position holds its own independent value. |
A Workflow Variable resets after a restart when you expected it to keep its value. | Turn on Persist Value for that variable. |
You can't find a variable you know exists. | Open the variable browser (the folder icon) and check under the scope you expect it in: Self and Parent variables only appear while you're inside the right element. |
Where to go next#