Grouper des itérations de boucles
Utilisez une fonction SimpleLoop avec une propriété Distinct Child Element afin de regrouper des itérations de boucles basées sur la valeur d'un élément enfant.
Avant de commencer
Pourquoi et quand exécuter cette tâche
<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>
Vous pouvez utiliser l'échantillon XML suivant pour créer votre structure de sortie :
<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>
Procédure
Résultats
<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>