set
Description
Creates a global variable with a value associated to it.
Input / Parameter
name
The name of the variable to create.
String/Text
-
-
Yes
value
The value associated to the variable.
String/Text
-
-
No
Output
Returns the formatted information.
Object
Object
success
Boolean value to denote whether the function was executed successfully.
Text
message
The message to print.
Text
data
Any additional message or data to print.
Text
Example
In this example, we will set the value of a global variable and check whether the variable has been set successfully in the console.
Steps
Drag a
button
component into the canvas and open theAction
tab. Select thepress
event of the button and drag theLog.write
function to the event flow.Call the function
Variable.set
inside thevalue
parameter of theLog.write
function. (*Note: TheLog.write
function is used here for ease of demostrating the output.)Create a variable called
version
with the value1.0.0
This will create a global variable called "version" containing the value "1.0.0" that can be accessed by other components or on other pages of your app.
Result
The value of the global variable
version
can be accessed by using the functionVariable.get
.Using the above flow will display the value
1.0.0
in the browser console.
Links
Related Information
See also:
Functions
Last updated