How to create a FOR loop in BizTalk mapper
In order to achieve this, we will be using the Iteration functoid. The Iteration functoid outputs the index of the current record in a looping structure.
The XSLT generated by the BizTalk mapper, processes elements with possible multiple instances using a loop. In other words, an order book with unbounded number of orders would usually force the mapper to loop through each of the Orders.
In order to create a FOR loop we require the ability to get the index of the current record as part of the iteration and that is where we use the iteration functoid. We then need to define a condition for our FOR loop (such as where index>10). This can be done using logical functoids such as the greater than functoid.
for (int index = 0; index < 10; index++)
// get the order
Order order = orders[index];
// now apply operation
This can be represented using the following map:
In the above map, the logical less than functoid checks to ensure that the record index returned by the iteration functoid is less than 10.