Skip to content

qie.getVariable

Signature: qie.getVariable(name)

Returns: Object result - the typed value of the variable

Returns the global or local variable with the specified name.

Parameters

Type Name Description Default
String name the name of the global or local system variable

Example

/*
+------+-----+
| name | age |
+------+-----+
| Bob  |  21 |
| Jaime|  43 |
| Tom  |  59 |
+------+-----+
*/

// Get a simple string variable
qie.setVariable("myVariableName", "StoresStringsOnly");
var myVar = qie.getVariable("myVariableName");                       // StoresStringsOnly

// Get a table variable (assumes "myVariableTable" is a table variable like the one shown above)
var table = qie.getVariable("myVariableTable");                      // Table

// Read table metadata
var headers = table.getHeaders();                                    // ["name","age"]

// Access cells/rows
var firstColumnOfSecondRow = table.getRows().get(1).get(0); // Jaime   (no headers; row index 1 is the 2nd data row)
var cellRow2Col0 = table.getCell(2, 0);                     // Jaime   (includes headers; row index 2 is the 2nd data row)

// Get an entire column (no headers) and join it
var namesCsv = StringUtils.join(table.getAllColumns(0), ",");         // Bob,Jaime,Tom