Overview
Global variables are used for parametrization. Read about global variables.
Set global variable using JavaScript
// props is a java.util.HashMap<String, String>
var props = com.toolsverse.config.SystemConfig.instance().getProperties();
// you can store strings in props
props.put("unique key", someValue);
Set global variable in parallel loop or transformation
This technique is used to set global variables in parallel loops and parallel transformations using a thread-safe container. These variables are only "visible" to the current ETL thread, so do not use this technique to set variables that can be accessed in other threads.
com.toolsverse.config.Access a previously-stored global variable from JavaScript
// props is a java.util.HashMap<String, String>
var props = com.toolsverse.config.SystemConfig.instance().getProperties();
// use the same key you stored in props.put(...)
var someValue = props.get("unique key");
Access global variable in parallel loop or transformation
This technique is used to access the value of the variable set in a parallel loop or parallel transformation. If the variable is not found in the current ETL thread this method will return the value set in the main thread.
// props is a java.util.HashMap<String, String>
var props = com.toolsverse.config.SystemConfig.instance().getContextProperties();
// use the same key you stored in props.put(...)
var someValue = props.get("unique key");
Access a previously-stored global variable from transformation and Connection
To access the value of the previously stored global variable from the transformation
or from the Connection parameters,
use {global variable name}. This will work equally well for variables set in the main thread and in the parallel loop or transformation.