Child pages
  • JSVariable

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Divcache
Div
iddescription
HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Constants Summary
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)DATETIME
styleindexdisplay:none

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClientsWordListMobileClient

Table Cell (td)
Number
Table Cell (td)INTEGER
servoy sSummary12%30%58%height: 30px;3Constants SummaryConstant to be used when the type of a variable needs to be specified. Table Row (tr) Table Row (tr)
Table Cell (td)
Number
Table Cell (td)MEDIA
Constant to be used when the type of a variable needs to be specified. Table Row (tr)
Table Cell (td)
Number
Table Cell (td)NUMBER
Constant to be used when the type of a variable needs to be specified. Table Row (tr)
Table Cell (td)
Number
Table Cell (td)TEXT
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.

HTML Table

idclassservoy sSummary

Colgroup Tag
Col
width80px
Col
Table Head (thead) Table Row (tr)style Table Row (tr)
Table Cell (td)
String
Table Cell (td)defaultValue
servoy sSummary12%30%58%height: 30px;
Table Head (th)
colspan2
Property Summary
3Property SummaryThe default value of the variable. Table Row (tr)
Table Cell (td)
String
Table Cell (td)name
Table Cell (td)variableType
The name of the variable. Table Row (tr)
Table Cell (td)
Number
The type of the variable.

HTML Table

idclassservoy sSummaryid

Colgroup Tag
Col
width80px
Col
Table Head (thead) Table Row (tr)style Table Row (tr)
Table Cell (td)
UUID
Table Cell (td)getUUID()
servoy sSummary12%30%58%height: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
getScopeName()
Get scope name
3Methods SummaryGet scope nameReturns the UUID of the variable

HTML Table

constantclass Colgroup Tag Colcolspanservoy sDetail2width100%

Col
Table Head (thead) Table Row (tr)styleheight:30px; Table Head (th)colspan2Constants Details Table Body (tbody)ididDATETIME Table Row (tr)name

Table Cell (td)

DATETIME

Table Row (tr)id

des Table Cell (td) DivclasssIndentConstant to be used when the type of a variable needs to be specified. Table Row (tr)idret

Table Cell (td)

Returns

div Table Body (tbody)
idINTEGER
Table Row (tr)
idname
Table Cell (td)

INTEGER

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
sIndentclients

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)
 

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
INTEGERname

INTEGER

dessIndentConstant to be used when the type of a variable needs to be specified.
Table Row (tr)idtdret

Returns

div Table Cell (td) Div
classsIndent
sIndentclients

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

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
MEDIAname

MEDIA

dessIndentConstant to be used when the type of a variable needs to be specified.
Table Row (tr)idtdret

Returns

div

class Div

classsIndent
sIndentNumber
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)clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
NUMBERname

NUMBER

dessIndentConstant to be used when the type of a variable needs to be specified.
Table Row (tr)idret

Table Cell (td)

Returns

divsIndentclients

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

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
TEXTname

TEXT

dessIndentConstant to be used when the type of a variable needs to be specified.
Table Row (tr)idret

Table Cell (td)

Returns

divsIndentclients

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
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Details
Table Body (tbody)
iddefaultValue
Table Row (tr)
idname
Table Cell (td)

defaultValue

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 

propertyservoy sDetail2100%height:30px2Property DetailsdefaultValuename

defaultValue

dessIndentThe 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
Table Row (tr)id variables it can be any string surrounded with quotes, like "'some text'".ret

Table Cell (td)class

Returns

Div Table Body (tbody)
idname
Table Row (tr)
idname
Table Cell (td)

name

Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
sIndentString
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)
 
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
namename

name

dessIndentThe name of the variable.
Table Row (tr)idret

Table Cell (td)

Returns

divsIndentclients

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
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
variableTypename

variableType

dessIndentThe type of the variable. Can be one of: TEXT, INTEGER, NUMBER, DATETIME or MEDIA.
ret

Table Cell (td)class

Returns

Div
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
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) sIndentNumber
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
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 

functionservoy sDetail2100%height:30px2Methods DetailsgetScopeNamename

getScopeName()

dessIndentGet scope nameret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow 
getUUIDname

getUUID()

dessIndentReturns the UUID of the variableret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow