Practicing with the ForEach Step

Prerequisites:

You performed the steps in Creating an Empty Orchestration Workflow for the ForEach Step.

In this exercise, you add a ForEach step to the ForEachOrchWF orchestration workflow and define values for it. When ForEachOrchWF is invoked, it appends an equals sign and the current loop index value to the default value of each data element in the list of data elements under Array[]. After Array[5] is processed, the resulting values are inserted in the Title box of the State3 state form after you click the OK button on the transition form between State2 and State3.

To use the ForEach step in an orchestration workflow:

  1. In App Explorer, under StepPaletteOrch, under Orchestration Workflows, select ForEachOrchWF.
  2. On the Data Mapping tab of the Property Editor, create an array of data elements as follows:
    1. Right-click the WorkingData step input, and then select Add New DataElement.
    2. While DataElement is still selected, type ArrayContainer, and then press the Tab key.
    3. Right-click ArrayContainer, point to Type[String], and then select Private Complex.
    4. Right-click ArrayContainer, and then select Add Child DataElement.
    5. While DataElement is still selected, type Array, and then press the Tab key.
    6. Right-click Array, and then select Properties Mode.
    7. In the properties area under Misc, select the IsUnbounded row.
    8. Click the down arrow next to False, and then select True.
    9. To close the properties area, right-click Array[], and then select Mapping Mode.
    10. Right-click Array[], and then select Add Array Element. Array[1] is added to Array[].
    11. Repeat the previous step four more times. Array elements Array[2], Array[3], Array[4], and Array[5] are added to Array[], under Array[1].
    12. In the Default value column for Array[1], type the word One; for Array[2], type Two; for Array[3], type Three; for Array[4], type Four; and for Array[5], type Five.
  3. Create a ForEach index:
    1. Right-click the WorkingData step input, and then select Add New DataElement.
    2. While DataElement is still selected, type Index, and then press the Tab key.
    3. Right-click Index, point to Type[String], and then select Integer .
    4. In the Default value column, type -1.
  4. Create a ForEach item value:
    1. Right-click the WorkingData step input, and then select Add New DataElement.
    2. While DataElement is still selected, type Value, and then press the Tab key.

      Leave the data type as String.

    3. In the Default value column, type Test.
  5. In the New Items section of the Step Palette, drag and drop a ForEach step onto the line between the Start and End steps.
  6. On the Options tab of the Property Editor, in the Source section, enter the following expression: ArrayContainer.Array
  7. In the New Items section of the Step Palette, drag and drop a Calculate step onto the line that loops back to the ForEach step.
  8. On the General tab of the Property Editor, change the Name to SetIndex, and then press the Tab key.
  9. On the Options tab, in the Target section, type the following: Index
  10. In the Expression section, enter the following expression: ForEach.index
  11. In the New Items section of the Step Palette, drag and drop a Calculate step onto the line that loops back to the ForEach step, to the right of the SetIndex step.
  12. On the General tab of the Property Editor, change the Name to SetValue, and then press the Tab key.
  13. On the Options tab, in the Target section, type Value
  14. In the Expression section, enter ForEach\item
  15. In the New Items section of the Step Palette, drag and drop a Calculate step onto the line that loops back to the ForEach step, to the right of the SetValue step.
  16. On the General tab of the Property Editor, change the Name to MakeTitle, and then press the Tab key.
  17. On the Options tab, in the Target section, enter the following: EventNoticeWithReply\Extension\Title
  18. In the Expression section, enter the following: CONCAT(EventNoticeWithReply\Extension\Title," ", STRING(Index)," =", STRING(Value), " ")
  19. Select the End step.
  20. On the Data Mapping tab of the Property Editor, under Extension, locate the Title data element, select the corresponding cell in the Source elements column, and then click the down arrow.
  21. In the Select a source tool, expand Inputs, EventNoticeWithReply, and Extension; select Title, and then click OK.