There's a lot ways to map between arrays of documents. But before you create one, consider these writings:
- Techcommunity SoftwareAG - performance impact with appendToDocumentList
- quest4apps.com - Reason to avoid appendToDocumentList
As hint from #2 said that there's 6 ways they ranked as follows from fastest to slowest (but I'm going to give an example in first three, because the latter three is quite obviously slow, which considered to be avoided):
1. Java Loop: looping done through a Java service.
- The easiest way to create java service is to map the input output first.

- Right-click and click on "Generate Code" until the dialog box appears
Choose the option "For implementing this service"
And the service is created
- Just re-arrange the code into this:
public static final void mappingDocuments(IData pipeline) throws ServiceException {
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
// Instantiate input A
IData[] A = IDataUtil.getIDataArray(pipelineCursor, "A");
// Initiate output B
IData[] B = new IData[A.length];
if (A != null)
{
for (int i = 0; i < A.length; i++)
{
// Populate the Field in doc A
IDataCursor ACursor = A[i].getCursor();
String Field1 = IDataUtil.getString(ACursor, "Field1");
String Field2 = IDataUtil.getString(ACursor, "Field2");
String Field3 = IDataUtil.getString(ACursor, "Field3");
ACursor.destroy();
// Create IData[i] and cursors finally put all Fields into B[i] variable output
B[i] = IDataFactory.create();
IDataCursor BCursor = B[i].getCursor();
IDataUtil.put(BCursor, "F1", Field1);
IDataUtil.put(BCursor, "F2", Field2);
IDataUtil.put(BCursor, "F3", Field3);
BCursor.destroy();
// OR JUST USE CLONE BELOW IF YOU DON'T HAVE ANY MODIFICATION INSIDE THE VARIABLE
// B[i] = IDataUtil.clone(A[i]);
}
}
pipelineCursor.destroy();
// Finally to put the B Map(IData) to output.
// Actually you can use only single pipelineCursor throughout all code but it's just for readable
IDataUtil.put(pipelineCursor, "B", B);
pipelineCursor.destroy();
}
- Result

2. Implicit Loop: for simple lists of the same size, you may want to link them directly in a MAP step
- Create flow service and input & output document
- Create MAP step
- Select both document in ForEach loop.

3. Explicit Loop: using a LOOP step and its Output Array.
- Create flow service and input & output document
- Create LOOP step
- Change the properties of LOOP, input array=A; output array=B; and create a map under LOOP step

- Map all parameters in A to B

Hope these helps...