Skip to main content
Version: 2026.0

vars

Methods​

exists​

exists(pName): boolean

Checks whether a JDito variable still exists or not.

Parameters​

pName
string | number | boolean

The name of the JDito variable ($local, $image, $global, $sys, $comp).

Returns​

boolean

'true' if the variable exists; otherwise 'false'.

Throws​

May throw an exception.

Example​

if(vars.exists("$image.histories") == true )
result.string(vars.getString("$image.histories"));

get​

get(pName): any

Returns the value of a variable as an object.

vars.get cannot only be used to retrieve values from arrays, but also to retrieve the values of individual variables with their original data types (integer, boolean).

With vars.getString(), the system will always return a string.

Parameters​

pName
string | number | boolean

The name of the JDito variable ($local, $image, $global, $sys, $comp).

Returns​

any

The value of the JDito variable you passed, as an object or its original data type.

Throws​

May throw an exception.

Example​

// Populate with data beforehand
var ret = new Array( new Array("Till", "McDohl"), new Array("Chris", "Lightfellow") );
vars.set("$global.persinfos", ret);
var record = vars.get("$global.persinfos"); logging.log( typeof record ); //Expected output: object

<b>//Querying the Current Table Selection</b>
// Query IDs (returns JSON):
var ids = vars.get("$field.DFO_Pers.selection");
// Query the contents of the selection (returns JSON):
var data = vars.get("$field.DFO_Pers.selectionRows");

<b> //Querying the Table View Selection</b>
// Query IDs:
var ids = vars.get("$field.result.selection");
// The result table uses the virtual "result" field
// Query the contents of the selection:
var data = vars.get("$field.result.selectionRows");

getString​

getString(pName): string

Returns the value of a variable always as a string, if the content of a variable is not a string, a conversion is attempted and the value after the conversion is returned.

Parameters​

pName
string | number | boolean

The name of the JDito variable ($local, $image, $global, $sys, $comp).

Returns​

string

The value of the JDito variable you passed, as a string.

Throws​

May throw an exception.

Example​

var company = vars.getString("$comp.ORGNAME");
logging.log( typeof company );
// Output: string

resolveVariables​

resolveVariables(pCode): string

Resolves the variables contained in the string.

Parameters​

pCode
string | number | boolean

The code that contains the variables to be resolved.

Returns​

string

The code that contains the values of the variables.

Throws​

May throw an exception.

Example​

var ret = vars.resolveVariables("Your login is $sys.user");
question.showMessage(ret);
// Example: "Your login is McDohl"

set​

set(pName, pValue): void

Sets an ADITO variable ($local, $global, or $image) or overwrites an existing variable.

Based on the prefix of the variable, the method detects the type of variable.

Parameters​

pName
string | number | boolean

Name of the variable; must begin with $local, $image, or $global.

pValue
any

The value of the variable.

Returns​

void

Throws​

May throw an exception.

Example​

//global variable
vars.set("$global.isAdmin", true);

//image variable
vars.set("$image.fcschedduling", true);

//local variable
vars.set("$local.under", "Under");