Set Variable
Command description
Creates or updates a local or global variable.
- Local variable:
local_var_name = var_value
- Global variable:
global_vars.var_name = var_value
Command Input Parameters
| input parameters | Input parameter type | Description |
|---|---|---|
| Variable Type | enum | Any, Text, Integer, Float, Number, Boolean, DateTime, List, Map, Web Element, Web Page, Desktop Element, Excel Object, Text List, Integer List, Float List, Number List, Boolean List, Web Element List, Web Page List, Desktop Element List, Excel Object List |
| Variable Value | PythonExpression | |
| Global Variable | bool | Whether to create a global variable. Defaults to a local variable |
Command Output Parameters
| Output parameters | Output parameter type | Description |
|---|---|---|
| Variable Name | any | Variable that receives the value. Its type is determined by Variable Value |
Note
The in.Variable Value field in workflow JSON is a Python expression. Runavelo parses the JSON and inserts this expression directly into the generated Python source.
For example:
[
{
"ins": "Set Variable",
"in": {
"Variable Type": "'Map'",
"Variable Value": "{'Name': 'John Doe', 'Age': 25, 'City': 'New York'}",
"Global Variable": "False"
},
"out": {
"Variable Name": "userInfo"
}
},
{
"ins": "Map Loop",
"in": {
"Map": "userInfo"
},
"out": {
"Key": "key",
"Value": "value",
"Index": "index"
},
"children": [
{
"ins": "Print Log",
"in": {
"Log Content": "f'Item {index+1}: {key} = {value}'",
"Render HTML": "False"
}
}
]
}
]