Map variables in transformations in Jitterbit Integration Studio
Introduction
You can use variables to pass dynamic values into your transformation mappings.
You can use three types of variables in transformations:
- Project variables: Defined at the project level and available throughout the project.
- Global variables: Defined anywhere in the project and must be initialized before use.
- Jitterbit variables: System variables provided by Jitterbit.
Access variables
When you access a transformation, variables appear in the Variables tab on the source (left) side. Icons indicate the variable type:
Project variable Global variable Jitterbit variable
A solid background (
Variables also appear in the Variables tab of the script component palette, organized by type.
Map variables to target fields
You can map variables using these three methods:
-
Drag and drop: From the Variables tab in the source structure or the script component palette, drag a variable to a target field.
-
Double-click: While editing a script, position your cursor in the target field script and double-click the variable to insert its reference.
-
Enter manually: While editing a script, type the variable reference using a dollar sign:
$variableName
.
Variable references in transformation scripts
Variables are prefixed with a dollar sign ($
) when used in scripts. For example, $variableName
.
You can also reference variables using the Get
function (or Set
for Jitterbit variables):
Get("variableName")
The variable name depends on how the variable was defined:
- Local variables use the name you assigned:
$tempValue
orGet("tempValue")
. - Project variables use the name you assigned:
$myProjectVariable
orGet("myProjectVariable")
. - Global variables use the name you assigned:
$myGlobalVariable
orGet("myGlobalVariable")
. - Jitterbit variables use predefined names with periods:
$jitterbit.operation.name
orSet("jitterbit.operation.name", "My Operation");
.
Create new variables
You can add a new variable when you view a transformation using one of these methods:
-
Project variables: In the source structure's Variables tab, click Create New Project Variable or from the script component palette, click Add New.
-
Global variables: Defined in scripts using this syntax:
$globalVariableName = "value";
. Global variables must be declared upstream of where they're used.
Note
When you use variables in transformations, note these considerations:
- Global variables without initialization default to empty values.
- Some Jitterbit variables may not apply to your specific operation.