Before you can add the logic that causes the iteration over a sequence of XML nodes in your business process, your project must contain an XML Schema or MFL file that defines the repeating XML or MFL element over which you want your business process to iterate. To learn how to import an XML Schema or MFL file into your project, see Importing Files into the Schemas Project.
After importing an XML Schema or MFL file into your project, you can complete the design of the For Each node. It includes the following tasks:
To Select a Repeating XML or MFL Element Over Which to Iterate
The For Each node only iterates over repeating elements. The node builder allows you to select a repeating node from the variable you created in the preceding section.
For example, if we import an XML Schema (QuoteRequest.xsd) into our project, and create a business process variable (requestXML) of type quoteRequest (based on the QuoteRequest.xsd schema), the requestXML variable is available in the drop-down list of business process variables:
Note: To learn about creating business process variables and importing schemas to your project, see Business Process Variables and Data Types and Importing Files into the Schemas Project.
Go to step 3.
The Create Variable dialog box opens.
The Create Variable dialog box closes and your new variable is displayed in the Select Node pane.
Note the following characteristics of the QuoteRequest.xsd schema as displayed in the preceding figure:
There can be one or more occurrences of the widgetRequest element in an associated XML document; this is represented by
in the GUI representation of the schema. The widgetRequest element, in turn, contains two elements: widgetId and quantity.
Note: In the example in the preceding figure, the repeating XML element (one or more occurrences) is represented by
in the GUI representation of the schema. A repeating XML element that specifies zero or more occurrences is represented by
.
The Repeating Element and Iteration Variable fields are populated with data:
In the Design View, note that the icon in your For Each node displays the following graphics:
To Add Activities to the For Each Node
You must define the activity or set of activities that are performed for each item in the list you created in the preceding step (To Select a Repeating XML or MFL Element Over Which to Iterate). Each iteration of the For Each loop executes the activity or activities you specify in a node (or nodes) in the loop.
As you drag a node onto the For Each loop, a target
appears on the loop, representing a valid location in the For Each loop where you can place the node. As you drag the node near the valid location, the target is activated
and the cursor changes to an arrow
. You can release the mouse button and the node snaps to the For Each loop.
To learn about designing For Each loops and how data is assigned to variables within the loops, see Looping Through Items in a List in Tutorial: Building Your First Business Process.
Grouping Nodes in Your Business Process
![]() |
![]() |