Local variables in Jitterbit are available only within the script or transformation mapping currently in use. Use a local variable only if the variable is just needed temporarily in the current script.
Creating a Local Variable
Since a local variable can't have a value before it is defined, you must define it before it is used.
In the system, a local variable is recognized by the absence of the dollar sign '$' that normally precedes the name of a global variable. Because the '$' is absent, a local variable is not "seen" globally. While a global data element can be used to pass a value among different scripts, the local variable stops being visible to the system after execution of the script that uses it.
To set and use a local variable, simply leave off the '$'. A local variable cannot be set or retrieved with
Variable names can be composed from these characters: letters (a-z, A-Z), numbers (0-9), and underscore. Other characters are not permitted and may cause issues. (Note that in the case of local variables, the period character is not allowed.)
In this example,
now is a local variable and is only available in this script (that is, before the terminating
</trans> tag). In contrast,
$tomorrow is a global variable that is available until the end of the current operation chain:
This example retrieves the value of a node, and if that value is null, sets it to the string "Not Set", and then returns the value:
This example retrieves the value of three nodes, adds the higher of the first two values to the third value, and then returns the third value: