Child pages
  • JSVariable

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Rev: 1381948887907

...

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Constants Summary
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#DATETIMEDATETIME
Constant to be used when the type of a variable needs to be specified.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#INTEGERINTEGER
Constant to be used when the type of a variable needs to be specified.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#MEDIAMEDIA
Constant to be used when the type of a variable needs to be specified.
Table Body (tbody)
tbody
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#NUMBERNUMBER
Constant to be used when the type of a variable needs to be specified.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#TEXTTEXT
Constant to be used when the type of a variable needs to be specified.

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

tbody
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary
tbody
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#defaultValuedefaultValue
The default value of the variable.
tbody
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#namename
The name of the variable.
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#variableTypevariableType
The type of the variable.

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

tbody
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
tbody
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getScopeNamegetScopeName()
Get scope name
Table Row (tr)
Table Cell (td)
UUID
Table Cell (td)
#getUUIDgetUUID()
Returns the UUID of the variable

HTML Table
idconstant
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Constants Details
Table Body (tbody)
idDATETIME
Table Row (tr)
idname
Table Cell (td)
DATETIME
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant to be used when the type of a variable needs to be specified.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var dateVar = solutionModel.newGlobalVariable('globals', 'gDate', JSVariable.DATETIME);
dateVar.defaultValue = 'now';
application.output(scopes.globals.gDate); // Prints the current date and time.
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idINTEGER
Table Row (tr)
idname
Table Cell (td)
INTEGER
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant to be used when the type of a variable needs to be specified.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var intVar = solutionModel.newGlobalVariable('globals', 'gInt', JSVariable.INTEGER);
intVar.defaultValue = 997;
application.output(scopes.globals.gInt); // Prints 997
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idMEDIA
Table Row (tr)
idname
Table Cell (td)
MEDIA
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant to be used when the type of a variable needs to be specified.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var mediaVar = solutionModel.newGlobalVariable('globals', 'gMedia', JSVariable.MEDIA);
mediaVar.defaultValue = 'new Array(1, 2, 3, 4)';
application.output(scopes.globals.gMedia); // Prints out the array with four elements.
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idNUMBER
Table Row (tr)
idname
Table Cell (td)
NUMBER
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant to be used when the type of a variable needs to be specified.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var numberVar = solutionModel.newGlobalVariable('globals', 'gNumber', JSVariable.NUMBER);
numberVar.defaultValue = 192.334;
application.output(scopes.globals.gNumber); // Prints 192.334
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idTEXT
Table Row (tr)
idname
Table Cell (td)
TEXT
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Constant to be used when the type of a variable needs to be specified.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var txtVar = solutionModel.newGlobalVariable('globals', 'gText', JSVariable.TEXT);
txtVar.defaultValue = '"some text"'; // Use two pairs of quotes if you want to assign a String as default value.
application.output(scopes.globals.gText); // Prints 'some text' (without quotes).
Table Row (tr)
classlastDetailRow
Table Cell (td)


HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Property Details
Table Body (tbody)
iddefaultValue
Table Row (tr)
idname
Table Cell (td)
defaultValue
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

The default value of the variable.

It is interpreted as a JS expression.

For form variables ,setting this property 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'".

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var intVar = solutionModel.newGlobalVariable('globals', 'gInt', JSVariable.INTEGER);
intVar.defaultValue = 997;
application.output(scopes.globals.gInt); // Prints 997
var numberVar = solutionModel.newGlobalVariable('globals', 'gNumber', JSVariable.NUMBER);
numberVar.defaultValue = 192.334;
application.output(scopes.globals.gNumber); // Prints 192.334
var dateVar = solutionModel.newGlobalVariable('globals', 'gDate', JSVariable.DATETIME);
dateVar.defaultValue = 'now';
application.output(scopes.globals.gDate); // Prints the current date and time.
var txtVar = solutionModel.newGlobalVariable('globals', 'gText', JSVariable.TEXT);
txtVar.defaultValue = '"some text"'; // Use two pairs of quotes if you want to assign a String as default value.
application.output(scopes.globals.gText); // Prints 'some text' (without quotes).
var mediaVar = solutionModel.newGlobalVariable('globals', 'gMedia', JSVariable.MEDIA);
mediaVar.defaultValue = 'new Array(1, 2, 3, 4)';
application.output(scopes.globals.gMedia); // Prints out the array with four elements.

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idname
Table Row (tr)
idname
Table Cell (td)
name
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The name of the variable.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var gVar = solutionModel.newGlobalVariable('globals', 'gtext', JSVariable.TEXT);
gVar.name = 'anotherName';
gVar.defaultValue = '"default text"';
// The next two lines will print the same output.
application.output(scopes.globals[gVar.name]);
application.output(scopes.globals.anotherName);

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idvariableType
Table Row (tr)
idname
Table Cell (td)
variableType
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
The type of the variable. Can be one of: TEXT, INTEGER, NUMBER, DATETIME or MEDIA.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var g = solutionModel.newGlobalVariable('globals', 'gtext',JSVariable.TEXT);
scopes.globals.gtext = 'some text';
g.variableType = JSVariable.DATETIME;
scopes.globals.gtext = 'another text'; // This will raise an error now, because the variable is not longer of type text.

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idgetScopeName
Table Row (tr)
idname
Table Cell (td)
getScopeName
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getScopeName
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get scope name
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var globalVariables = solutionModel.getGlobalVariables();
for (var i in globalVariables)
	application.output(globalVariables[i].name + ' is defined in scope ' + globalVariables[i].getScopeName());

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetUUID
Table Row (tr)
idname
Table Cell (td)
getUUID
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
UUID
Span
stylefont-weight: bold;
getUUID
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the UUID of the variable
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
UUID
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var dateVar = solutionModel.newGlobalVariable('globals', 'gDate', JSVariable.DATETIME);
application.output(dateVar.getUUID().toString());

...

Table Row (tr)
classlastDetailRow
Table Cell (td)