For Each activity

The For Each activity iterates through recurring elements of a variable, performing other activities during each iteration cycle.

About this task

When you drop a For Each activity onto an orchestration, Studio creates the following two variables:

  • loopvalue_X - During run time, as the For Each activity loops through a set of recurring elements, the loopvalue_X variable contains the value of the current element.
  • loopcounter_X - During run time, as the For Each activity loops through a set of recurring elements, the loopcounter_X variable contains the current count of the number of iteration cycles that have been processed by the For Each activity.

Where X is equal to the number of For Each activities that have been dropped on the orchestration. For example, when the first For Each activity is dropped on an orchestration, the variables called loopvalue_1 and loopcounter_1 are created.

Attention: Do not use the loopvalue_X and loopcounter_X variables outside of the For Each activity. The scope of these variables are limited to the For Each activity.
 

To use a For Each activity complete the following steps:

Procedure

  1. Open the Activities tab and the Logic folder.
  2. Drag the For Each activity onto the orchestration.
  3. In the Variable Name field, select a variable containing the recurring element that you want to loop through in the For Each activity.
  4. In the Element Name field click [...] to browse for the recurring element that you want to loop through in the For Each activity. The Select Recurring Element window is displayed.
  5. Select a recurring element and click OK.

Results

An XPath expression that refers to the recurring element is displayed in the Element Name field. The Variable Name field is automatically populated with the loopvalue_X variable created for this For Each activity. You can edit the generated XPath expression in the Element Name field.

You can add other activities within the For Each loop. Use the Break Loop and Continue activities to control iterations of the For Each loop.




Feedback | Notices


Timestamp icon Last updated: Wednesday, 15 June 2016


http://pic.dhe.ibm.com/infocenter/wci/v7r0m0/topic/com.ibm.wci.doc/orch_For_Each_Activity.html