Scenario variables
Overview
Scenario variables are data areas that store values for the operation of scenario components and the interaction of the scenario with the external environment.
Variables are created during script editing, described in the body of the JSON structure of the script. The data area is allocated only at the moment of script execution.
Variables can be passed between scripts. Despite the presence of an identifier, for ease of editing scripts, the mapping is done by variable name.
Areas of visibility
Area of visibility | Description |
---|---|
Local |
Available only to a specific instance of the script handler. The values are stored in its stack. |
Scripted |
Available to all instances of a particular scenario (by scenario code). Stored in a shared storage on the site with a specific key (role st). |
Website domains |
Available to all scripts of the current domain executing within the same site. Stored in shared storage on the site with a specific key (role st). |
Site Shared |
Available to all scripts of all domains executing within the same site. Stored in shared storage on the site with a specific key (role st). |
Global domains |
Available to all scripts of the current domain, executed on any site where the domain is served. Stored in shared storage on a site with a specific key (role st), synchronized between sites. |
Global commons |
Available to all scripts of all domains, executed on any site where the domain is served. Stored in shared storage on the site with a specific key (role st), synchronized between sites. |
When too large a value is saved to a variable whose value is stored in shared storage, it is placed in the filesystem (category :SYNC), and the file path is automatically placed in place of the variable.
Value types
Value type | Description |
---|---|
number |
An integer or a number with a decimal point. |
String |
String value. Stored as a structure containing the value and encoding. |
Date-Time |
String value in the format RFC3339. |
Value conversion
In operations where synchronization of value types is important, values are automatically converted from one type to another. If conversion errors occur, the behavior depends on the specific operation.
Initial values
Registered local variables are created with empty values when the script is run. They cannot be used in expressions until values are assigned.
In the Start component, it is allowed to set the default mode for assigning start values.
The initial values of local variables can also be set when the script handler is started from the entity settings of a particular script (opts.variables
field), assigned from parent processes, copied from parent scripts, etc.
Variables with a scope other than local are only created when values are directly assigned within the script.