Skip to end of metadata
Go to start of metadata

Introduction

Variables can be mapped 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.

WARNING: There is a known issue where mapping variables that have a period in the variable name isn't working properly, resulting in an incorrect target field mapping in the transformation. Until this issue is resolved, rename global variables by replacing any periods with underscores or removing periods another way. Because of this issue, at this time Jitterbit variables are unable to be referenced within a transformation.

Mapping to a Target Field

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 will be solid  if the variable has a default value, or empty  if it does not.

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 will be returned.

Project, global, and Jitterbit variables are available to use in the transformation:

  • Project Variables: Project variables that have already been created and are available to use globally within the project. To create or edit a new project variable:
    • Mapping Mode: To create a new project variable, click Create New Project Variable, or 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, or 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.

To manually map a variable in mapping mode, within the Variables tab on the left, drag a variable to an appropriate target field on the right:

To manually map a variable in script mode, within the Variables tab on the right, drag a variable on the right to an appropriate target field on the left:

In both modes, the mapped variable will visually be displayed within the target field, with a script icon  added in the top right to indicate the field has a mapping:

To view or edit the mapping as a script, click the script icon  to open the editable script area for the target field in script mode:

An alternative to drag-and-drop is to manually type or paste variable references into a target field script. To add a new script on a target field, in either mapping mode or script mode, hover over the target field and click the plus icon  in the upper right to open a menu of actions. From the menu select Add Script:

This opens the editable script area on the target field in script mode, where you can enter the variable reference(s) along with any other script logic. 

You can also drag the specific variable from the palette to the script, or begin typing the variable name and then press Control+Space to display a list of autocomplete suggestions. Select a variable to insert the appropriate syntax.

For a larger script area to work within, click the popout icon  in the upper right of the target field, which opens the full script editor. Once within the full script editor, click the return icon  to come back to this screen.

Mapping to a Field with an Existing Mapping

When dragging and dropping a variable to a target field that already has a mapping, you will be presented with the option to copy the variable reference to your clipboard so that you can manually paste that reference into the script logic:

Upon clicking Continue, the target field will become 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. For example:

When the editable script area is open, you can drag and drop other variables from the palette to the script to insert the reference path directly.

You could also manually type or paste variable references into a target field script if desired. For a larger script area to work within, click the popout icon  in the upper right of the target field, which opens the full script editor. Once within the full script editor, click the return icon  to come back to this screen.

Removing a Mapping

You can remove target field mappings one at a time, or all at once for all field mappings contained within a node or all invalid field mappings contained within a node.

Remove a Single Field Mapping

To remove a single variable mapping from a target field, or unmap the field, hover over the variable within the target field and click the trash icon :

For mappings with multiple mapped objects or scripts, hover over the variable within the target field and click the edit icon , then edit the script to remove the variable mapping:

The editable script area is also accessible by clicking the script icon  on the target field.

Within the editable script area, you can also manually clear the contents of the target field script to remove the entire mapping.

Remove Multiple Field Mappings

To remove all target field mappings contained within a node, from either mapping mode or script mode, hover over a node name and click the actions menu icon  to open the actions menu. From the menu, select Clear mappings beneath this node:

This will delete all mappings on fields contained within the node, as well as all mappings on fields contained within sub-nodes of that node. Upon selecting this option, a message will ask you to confirm that you want to delete mappings. Note that using this option on a root node will remove all mappings from the transformation.

To remove only invalid target field mappings contained within a node, from either mapping mode or script mode, hover over a node name and click the actions menu icon  to open the actions menu. From the menu, select Clear invalid mappings only:

This will delete all invalid mappings on fields contained within the node, as well as all invalid mappings on fields contained within sub-nodes of that node. For more information about invalid mappings, see Transformation Mapping Validity.

On This Page

Last updated:  Mar 03, 2020

  • No labels