JSVariable
Last updated
Last updated
JSVariable
represents script variables in the Solution Model. It allows defining variables with specific types, default values, and scope, offering flexibility for use in forms, global contexts, and dynamic scenarios. Variables can be configured with types like TEXT
, INTEGER
, NUMBER
, DATETIME
, or MEDIA
. ## Functionality
JSVariable provides constants for specifying the variable type. Properties like defaultValue
, name
, and variableType
allow precise control over the variable's configuration. The defaultValue
property can accept expressions such as dates, numbers, or text, enabling dynamic initialization. Methods like getScopeName
and getUUID
facilitate metadata access, such as identifying the variable's scope or its unique identifier.
Examples demonstrate how to create variables dynamically, assign default values, and use them in various scopes. Variables can also be modified to change their type or default behavior.
Variables can alternatively be created and managed using the Variable Editor.
Type | Name | Summary |
---|---|---|
Type | Name | Summary |
---|---|---|
Constant to be used when the type of a variable needs to be specified.
Type Number
Sample
Constant to be used when the type of a variable needs to be specified.
Type Number
Sample
Constant to be used when the type of a variable needs to be specified.
Type Number
Sample
Constant to be used when the type of a variable needs to be specified.
Type Number
Sample
Constant to be used when the type of a variable needs to be specified.
Type Number
Sample
The default value of the variable.
It is interpreted as a JS expression.
For form variables, setting this property via solutionModel requires the form instances to be destroyed (history.remove("formName")). If you want to use a default value for a newly created variable create the variable using the 3 parameter version newVariable(name,type,defaultValue).
For INTEGER variables it can be an integer constant, like 10 for example. For NUMBER variables it can be a real constant, like 22.41. For DATETIME variables it can be "now", or a JS expression like "new Date()". For TEXT variables it can be any string surrounded with quotes, like "'some text'".
Type String
Sample
The name of the variable.
Type String
Sample
The type of the variable. Can be one of: TEXT, INTEGER, NUMBER, DATETIME or MEDIA.
Type Number
Sample
Get scope name
Returns: String
Sample
Returns the UUID of the variable
Returns: UUID
Sample
Type | Name | Summary |
---|---|---|
Constant to be used when the type of a variable needs to be specified.
Constant to be used when the type of a variable needs to be specified.
Constant to be used when the type of a variable needs to be specified.
Constant to be used when the type of a variable needs to be specified.
Constant to be used when the type of a variable needs to be specified.
The default value of the variable.
The name of the variable.
The type of the variable.
Get scope name
Returns the UUID of the variable