You're
viewing Apigee X documentation.
View Apigee Edge documentation.
The Data Mapping task lets you perform variable assignments in your integration. Use this task to map the output values of a task to another task's input values, as shown in the figure below:
The Data Mapping task lets you
perform variable assignments in your integration. The variables can be integration variables or
task variables. For example, you can assign values from integration variable X
to a task variable Y
or from a task variable Y
to integration
variable X
. For more information about variable types,
see Using variables
in Apigee Integration.
Configure the Data Mapping task
To configure the Data Mapping task:
- Go to the Apigee UI and sign in.
- Select your organization using the drop-down menu in the upper left corner of the UI.
- Click Develop > Integrations.
- Search for or select the integration to edit from the Integrations list and click to open the integration designer.
- Click Add a task/trigger > Tasks to view the list of available tasks.
- Drag the Data Mapping element to the integration designer.
- Click the Data Mapping element on the designer to open the Data Mapping configuration pane.
The following image shows the layout of the Data Mapping Editor:
Add a mapping
To add a mapping, perform the following steps:
- Click Open Data Mapping Editor.
The Data Mapping Editor lets you map input variables to the output variables, using the available transformation functions. The output is then available as a variable to any other integration task or trigger. For more information about passing data as variables, see Using variables in Apigee Integration.
- Configure the Input and Output columns:
- Drag a variable from the left-hand variable list into the Input column.
- Alternatively, click enter a value to input a literal or reference value.
- Enter an initial value (of type
string
,integer
,double
, orBoolean
) or choose an existing variable. - To choose an existing variable, type an existing variable name into the search field.
- To create a new variable, click + Add new variable to enter the name and data type of the new variable.
- Click Done.
- Click + Add function on any input variable to view the list of
available transform functions.
The Data Mapping task lets you apply a number of data mapping functions to transform the data in the input variable.
To remove or delete the most recently added function, click the - symbol.
- Drag a variable from the right-hand variable list into the Output column. If the variable is not
available, click + Add new variable to configure the name and data type of the new variable. Optionally,
you can select whether to use the variable as an output of the integration, or as an input to another integration, as shown
in the image below:
- To remove a variable, click the x icon on the variable pill.
- To delete a mapping row, click Delete this mapping.
- Once your mapping is complete, close the pane. Any changes will be autosaved.
The completed data mapping is available to view from the Integration editor, by clicking on the Data Mapping element, as shown in the figure below:
Supported data types
Apigee Integration supports the following data types for variables in the Data Mapping task:
- Strings and String arrays
- Integers and Integer arrays
- Doubles and Double arrays
- Booleans and Boolean arrays
- JSON
Retry on failure
You can configure various retry strategies to handle errors in a task. The retry strategies allow you to specify how to rerun the task in case of an error. For more information, see Error handling strategies.
Best practices
Using the Data Mapping task can be a powerful way to transform and pass key variables to various tasks in your integration. Here are a few tips to keep in mind as you build your integration:
- Mappings are run in sequence from top to bottom. That is, if input variable
A
is mapped to an output variableB
in the first row, the variableB
is available for mapping in the subsequent rows. - In each row, the data type of the Input column must match the data type of the Output column.
To cast between types, use transformation functions such as
TO_STRING
,TO_INT
, etc. - There are no limitations on the length of transformation chaining. However, debugging large chained transformations can be difficult. We recommend keeping input transformations readable and splitting complex transformations into multiple mappings.
- If a mapping requires a fallback value, set a fallback value for the mapping. If you do not provide a fallback value, the
mapping returns an error when the input value or transformation returns
null
. - When deleting a variable, make sure to delete any mapping that contains it.
Considerations
We do not recommend using the Data Mapping task to loop over arrays. Instead, create a variable representing an element of the array and then map each subsequent element in a sub-integration. You can call the resulting sub-integration using one of the following tasks: