Variables in SteelEngine act as a global store for data that can be accessed and modified by any block in your workflow, allowing you to store and share data across your workflow with global variables. They provide a powerful way to share information between different parts of your workflow, maintain state, and create more dynamic applications.
Variables allow you to store and share data across your entire workflow, making it easy to maintain state and create complex, interconnected systems.
Overview
The Variables feature serves as a central data store for your workflow, enabling you to:
Store global data: Create variables that persist throughout workflow execution
Share information between blocks: Access the same data from any block in your workflow
Maintain workflow state: Keep track of important values as your workflow runs
Create dynamic workflows: Build more flexible systems that can adapt based on stored values
Creating Variables
You create and manage variables in the Variables modal. To open it, choose Variables from the More options menu at the top of the workflow panel. Each variable has:
- Name: A unique identifier used to reference the variable
- Type: Plain, Number, Boolean, Object, or Array
- Value: The data stored in the variable, entered in the format the type expects
To set or change a variable's value while a workflow runs, use the Variables block. It assigns values by variable name, and any later block reads the updated value.
Accessing Variables
Variables can be accessed from any block in your workflow using the variable dropdown. Simply:
- Type
<in any text field within a block - Browse the dropdown menu to select from available variables
- Select the variable you want to use
You can also drag the connection tag into a field to open the variable dropdown and access available variables.
Variable Types
Variables in SteelEngine can store various types of data:
"Hello, World!"Text variables store strings of characters. They're useful for storing messages, names, and other text data.
Using Variables in Blocks
When you access a variable from a block, you can:
- Read its value: Use the variable's current value in your block's logic
- Modify it: Update the variable's value based on your block's processing
- Use it in expressions: Include variables in expressions and calculations
Variable Scope
Variables in SteelEngine have global scope, meaning:
- They are accessible from any block in your workflow
- Changes to variables persist throughout workflow execution
- Variables start fresh from their defined values on each run. Changes during execution are visible within that run only
Limits
- All variables of a workflow, serialized as JSON, must stay within 64 KiB. SteelEngine rejects a save that would exceed the limit and reports the current and maximum size. The one exception is a change that shrinks a set that is already over the limit.
- Values must be JSON-safe: finite numbers only (no
NaNorInfinity), and no cyclic references inside objects or arrays.
The editor reads and saves variables through GET and POST {{API_URL}}/api/workflows/{workflowId}/variables. These endpoints accept the signed-in session, not API keys. POST replaces the whole set.
Best Practices
- Use Descriptive Names: Choose variable names that clearly indicate what the variable represents. For example, use
userPreferencesinstead ofup. - Consider Variable Scope: Remember that variables are global and can be modified by any block. Design your workflow with this in mind to prevent unexpected behavior.
- Initialize Variables Early: Set up and initialize your variables at the beginning of your workflow to ensure they're available when needed.
- Handle Missing Variables: Always consider the case where a variable might not yet exist or might have an unexpected value. Add appropriate validation in your blocks.
- Limit Variable Count: Keep the number of variables manageable. Too many variables can make your workflow difficult to understand and maintain.