Mapping variables in transformations in Jitterbit Integration Studio
Introduction
You can map variables to a target field in either mapping mode or script mode. When you map a variable, the variable reference is inserted into a script on the target field. Variable references are constructed with a dollar sign ($
) preceding the variable name. For information on creating, configuring, and using variables, see Variables.
Access variables for mapping
In mapping mode, existing variables are listed by type within the Variables tab on the source side of the transformation:
Within the list, the type of each variable is indicated by the icon next to the name:
for global variable for project variable for Jitterbit variable
The icon's background is solid
In script mode, existing variables are listed within the Variables tab of the script component palette in sub-tabs for each type:
Both modes have a search box where you can enter a keyword or keywords separated by commas. Variables that have any part of the keywords in their name are returned.
Project, global, and Jitterbit variables are available to use in a transformation:
-
Project Variables: Project variables that have already been created and are available to use globally within the project. To create or edit a project variable:
-
Mapping Mode: To create a new project variable, click Create New Project Variable. To edit an existing project variable, hover over the variable and click the edit icon.
-
Script Mode: To create a new project variable, click Add New. To edit an existing project variable, click the name of the variable.
-
-
Global Variables: Global variables that have been defined anywhere in the project.
Warning
Global variables should be declared upstream of the transformation to be used within the transformation. If the global variable has not been initialized, the default value for a global variable is empty.
-
Jitterbit Variables: Jitterbit variables that are available to use globally within the project.
Caution
Some Jitterbit variables that are listed may not be applicable to the specific operation. Refer to the documentation on each variable under Jitterbit variables.
Map to a target field
You can map variables by dragging and dropping, double-clicking, or manually inserting the variable's reference path:
-
Drag and drop: You can drag and drop variables in mapping mode and script mode:
-
Mapping mode: Within the Variables tab on the left, drag a variable to an appropriate target field on the right.
-
Script mode: Within the Variables tab on the right, drag a variable to an appropriate target field on the left.
-
-
Double-click: In script mode, double-click the variable in the Variables tab to insert the variable's reference at your cursor's location within the script.
-
Manual insertion: You can open an editable script area to manually enter variable references from either mapping mode or script mode. To add a new script on a target field, hover over the target field and click .
A referenced variable is displayed within the mapped target field:
for global variable for project variable for Jitterbit variable
Map to a field with an existing mapping
When dragging and dropping a variable to a target field that already has a mapping, you are presented with the option to copy the variable reference to your clipboard so that you can manually paste that reference into the script logic:
Dialog text
Add Project Variable to Script
This target field already has a script. The project variable reference must be added using the script editor. Paste it into the script from your clipboard or drag it into the script from the component palette.
On clicking Continue, the target field becomes expanded with an editable script area for you to paste in the variable reference in script mode. For mappings that contain multiple references, you must then add scripting logic to make the script valid.
When adding additional variable references by double-clicking or manual insertion, the dialog for copying a variable reference is not presented. However, you can add multiple variable references into the editable script area by double-clicking, dragging and dropping, or manually inserting the references.
Edit or remove a mapping
While in mapping mode or script mode, you can edit or remove target field mappings one at a time or remove all field mappings contained within a node:
- Edit or remove a mapping in mapping mode.
- Edit or remove a mapping in script mode.