Practicing With the While Step

Prerequisites:

You performed the steps in Creating an Empty Orchestration Workflow For the While Step.

In this exercise, you add a While step to the WhileOrchWF orchestration workflow and define values for it. When WhileOrchWF is invoked, it counts the number of the strings in the Title box that consist of the letters one. If you type oneoneoneoneone in the Title box, the following text is inserted in the Title box of the State3 state form when you click the OK button on the transition form between State2 and State3: I found 5 ones.

To use the While step in an orchestration workflow:

  1. In App Explorer, under StepPaletteOrch, under Orchestration Workflows, select WhileOrchWF.
  2. On the Data Mapping tab of the Property Editor, create a loop counter as follows:
    1. Right-click the Working Data step input, select Add New, and then select Integer.
    2. Change the name of the new data element (Integer) to LoopCounter.
    3. In the Default value column, type the number 0.
  3. Create a temporary storage area for the working title as follows:
    1. Right-click the Working Data step input, select Add New, and then select String.
    2. Change the name of the new data element (String) to WorkingTitle.
    3. For the WorkingTitle data element, select the cell corresponding to the Source elements column, and then click the down arrow.
    4. In the Select a source popup, expand Inputs, EventNoticeWithReply, and Extension; select Title; and then click OK.
  4. In the New Items section of the Step Palette, drag a While step onto the orchestration workflow editor, and drop it between the Start and End steps.
  5. On the Options tab of the Property Editor, in the Rule section, enter the following function: CONTAINS(WorkingTitle,"one")
  6. In the New Items section of the Step Palette, drag and drop a Calculate step onto the top loop (the repeating section) of the While step.
  7. On the General tab of the Property Editor, change the Name to Counter, and then press the Tab key.
  8. On the Options tab, in the Target section, enter the following: LoopCounter
  9. In the Expression section, enter the following: LoopCounter+1
  10. In the New Items section of the Step Palette, drag and drop a Calculate step onto the top loop of the While step, to the right of the Counter step.
  11. On the General tab of the Property Editor, change the Name to Title, and then press the Tab key.
  12. On the Options tab, in the Expression section, enter the following: SUBSTRINGAFTER(WorkingTitle,"one")
  13. In the Target section, enter the following: WorkingTitle
  14. In the New Items section of the Step Palette, drag and drop a Calculate step onto the bottom loop (the non-repeating section) of the While step.
  15. On the General tab of the Property Editor, change the Name to EndTitle, and then press the Tab key.
  16. On the Options tab, in the Expression section, enter the following function: CONCAT("I found",STRING(LoopCounter)," ones.")
  17. In the Target section, enter the following: WorkingTitle
  18. Select the End step.
  19. On the Data Mapping tab, expand Extension, locate the Title data element, select the corresponding cell in the Source Elements column, and then click the down arrow.
  20. In the Select a source popup, expand WhileOrchWF, Inputs, EventNoticeWithReply, and Extension; select Title; and then click OK.