This documentation describes the old version of our handlebars powered mapper which is not available by default. We will stop supporting it by the end of Q1 2018. Please read the Migration guide to the new mapping language to get started with the new JSONata powered mapper.

This article described the case of mapping when an incoming Array structure needs to be mapped into an outgoing Array structure. This is known as array mapping or many-to-many mapping.

Use case: Amazon Orders to SAP Orders

To demonstrate the ability of many-to-many mapping we will construct a flow with the following steps:

  1. Query Amazon MWS orders (amazonmws:listOrders) - for example, Pending, Shipped, etc and pass that information to the next stage. We are getting only information about specific types of orders.
  2. Query Amazon MWS for items in each order (amazonmws:listOrderItems) - we will use the order Ids which we have from the step 1 to get order items. Now we have the information what those orders include.
  3. Create orders in SAP ByDesign (sapbydesign:create_order) - we collect all the data from Amazon MWS and create orders inside our SAP ByDesign.

After the second step, we would have an incoming array of orders indicated by [..].

We will now take this array and match it with the structure accepted by SAP By Design. For example, we take items[*] array, which is again indicated by [..].

When we select it to configure, we will be taken one level deeper and an opportunity to configure the fields inside would be presented. Notice the breadcrumb structure which shows that we are now one level deeper. You can return to the Root level by clicking on the name.

There are several noticeable things here:

  1. We see where we are now in regards to the Root structure
  2. We see also the incoming fields from the previous step (Step2) which contains an array structure [..] orderItems as well as the field amazonOrderId. For this Product ID field, we will take the last one for obvious reasons.
  3. We have an incoming data from Step1 which is available due to our Passthrough feature.

To show how flexible this process can be we will take the MainPrice field of the SAP By Design.

We can go even one level deeper here to select exactly what we want to map.

This use case shows how complex data can be mapped. It should be noted that the prior knowledge of incoming and outgoing structures is required to use this feature to its full potential.