Grouping loop iterations
Use a SimpleLoop function with a Distinct Child Element property to group loop iterations based on the value of a child element.
Before you begin
About this task
<orders>
<item>
<itemId>1268168</itemId>
<orderId>45632</orderId>
<customerName>John Smith</customerName>
<shipping>
<street>South Highway</street>
<city>San Diego</city>
<state>California</state>
</shipping>
</item>
<item>
<itemId>1684157</itemId>
<orderId>45632</orderId>
<customerName>John Smith</customerName>
<shipping>
<street>South Highway</street>
<city>San Diego</city>
<state>California</state>
</shipping>
</item>
<item>
<itemId>1168468</itemId>
<orderId>46987</orderId>
<customerName>Jane Harrison</customerName>
<shipping>
<street>Bailard Avenue</street>
<city>Los Angeles</city>
<state>California</state>
</shipping>
</item>
<item>
<itemId>1544417</itemId>
<orderId>46987</orderId>
<customerName>Jane Harrison</customerName>
<shipping>
<street>Bailard Avenue</street>
<city>Los Angeles</city>
<state>California</state>
</shipping>
</item>
<item>
<itemId>1168468</itemId>
<orderId>47949</orderId>
<customerName>Jack Monroe</customerName>
<shipping>
<street>Steele Lane</street>
<city>Las Vegas</city>
<state>Nevada</state>
</shipping>
</item>
<item>
<itemId>1388147</itemId>
<orderId>47949</orderId>
<customerName>Jack Monroe</customerName>
<shipping>
<street>Steele Lane</street>
<city>Las Vegas</city>
<state>Nevada</state>
</shipping>
</item>
</orders>
You can use the following XML sample to create your output
structure:
<orders>
<order>
<orderId/>
<customerName/>
<shipping>
<street/>
<city/>
<state/>
</shipping>
<items>
<itemId/>
<itemId/>
</items>
</order>
<order>
<orderId/>
<customerName/>
<shipping>
<street/>
<city/>
<state/>
</shipping>
<items>
<itemId/>
<itemId/>
</items>
</order>
</orders>
Procedure
Results
<orders>
<order>
<orderId>45632</orderId>
<customerName>John Smith</customerName>
<shipping>
<street>South Highway</street>
<city>San Diego</city>
<state>California</state>
</shipping>
<items>
<itemId>1268168</itemId>
<itemId>1684157</itemId>
</items>
</order>
<order>
<orderId>46987</orderId>
<customerName>Jane Harrison</customerName>
<shipping>
<street>Bailard Avenue</street>
<city>Los Angeles</city>
<state>California</state>
</shipping>
<items>
<itemId>1168468</itemId>
<itemId>1544417</itemId>
</items>
</order>
<order>
<orderId>47949</orderId>
<customerName>Jack Monroe</customerName>
<shipping>
<street>Steele Lane</street>
<city>Las Vegas</city>
<state>Nevada</state>
</shipping>
<items>
<itemId>1168468</itemId>
<itemId>1388147</itemId>
</items>
</order>
</orders>