The Variable object
Variables that store temporary state.
Each instance has a unique name with which to reference (e.g., myVariable1.value
).
Properties
All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
variable.setIn()
Set the value of a nested key. This method returns a promise and can only be used in JavaScript queries, not in transformers or {{ }}
dynamic expressions.
Definition
await variable.setIn(options)
Parameters
Examples
Set the value of userKey
in variable
to userValue
.
variable.setIn({keyPath: 'userKey', value: userValue});
Definition
variable.setValue(key, value)
Examples
Set the current value of variable
to userValue
.
variable.setValue(userValue);