The var.push: command appends a value to an array.
start:
set:
numbers@csv: 1,2,3,4
var.push:
output: result
inputs:
key: numbers
value: 5
return:
output@text:
{{numbers|join(', ')}}
{{result|json_encode}}
Result:
output:
1, 2, 3, 4, 5
["1","2","3","4","5"]
Syntax
inputs:
Key | Req’d | |
---|---|---|
key: |
√ | The key path of the value to append to, delimited with colons (: ). |
value: |
√ | The value to append. |
output:
The optional placeholder to store the result.
on_simulate:
The commands to run during simulation instead of appending the value.
If omitted, the value is appended during simulation.
on_success:
The commands to run on success.
The optional output:
placeholder is set to the new array after appending.
on_error:
The commands to run on failure. If omitted, the automation exits in the error
state.
The output:
placeholder receives a dictionary with these keys:
Key | |
---|---|
error |
The error message. |