For an example of recording a loop see the tutorial topic Step 2.4: Record the flow.
To prepare for recording a loop:
Determine which of the application screens in the repeated sequence you want to use with each of the loop controls: Begin Loop, End Loop, Exit Loop, and the Exit Flow Loop window (see Controls for recording a loop).
Create a screen description for each of these application screens.
See the example of preparing for recording a loop in the first tutorial (see A. Prepare for the flow recording).
The following sequence of steps assumes that flow recording is already in progress. To record a repeating sequence of screens as a loop:
(see Controls for recording a loop).
icon is replaced with the End Loop icon
to indicate
that a loop is being recorded and that you now need to navigate to
the application screen that you want to use with the End
Loop control. (See Step 3.)If you have not selected a variable message file and a variable message for the current flow then the host editor opens the No Variable Message File window and prompts you to select or create a message file and a message for the flow (see Specifying a variable message later on during flow recording). Make your selections and click OK.
From the list of variables displayed in the window select the variable that you want to use as the loop variable.
You can create a new variable by clicking Add new variable and typing a variable name. The window creates a new String variable and adds it to the list of available variables.
At runtime the value stored in the loop variable indicates to the While node of the loop whether to perform another iteration of the loop or to stop looping (see Recorded loop: Non-iterative case).
Navigate completely through one iteration of the loop that you are recording until you again arrive at the Begin Loop application screen.
On the toolbar of the host editor click End
Loop
(see Controls for recording a loop).
The host editor makes two changes in the toolbar:
It replaces the End Loop icon
with the Exit
Loop icon
to remind you that you have reached
the stage in loop recording in which you are seeking for the Exit
Loop application screen.
It disables the Stop Flow Recording icon
to remind you that flow recording is temporarily
suspended until you identify the Exit Loop screen.
Why flow recording is suspended: The reason for temporarily suspending flow recording is so that the host editor does not record any application screens between the End Loop application screen and the Exit Loop application screen. It is not necessary to record these intervening application screens because the application screens in the loop that you are recording handles them.
Navigate through the application until you arrive at the first application screen that the user encounters when the loop terminates. This screen is Exit Loop application screen.
Click the Exit Loop
(see Controls for recording a loop).
The Exit Flow Loop window opens.
In the Exit Flow Loop window:
In the upper pane of the Exit Flow Loop window select the check box beside any listed application screen that you want to identify as a valid exit point from the recorded loop.
The upper pane of the window lists the screen descriptions of all the exit-from screens in the recorded loop. An exit-from screen is an application screen inside a loop from which navigation can flow to the Exit Loop screen in one step (see Exit-from screens). Depending on the structure of the terminal application the list can contain a single exit-from screen or several.
Selecting an exit-from screen in this list causes the recorded loop to terminate when navigation goes from the selected exit-from screen to the Exit Loop screen in one step. The recorded loop does not terminate until navigation passes from a selected exit-from screen to the Exit Loop screen in one step (see Exit-from screens).
As a visual aid the lower pane of the window shows a thumbnail image of the currently selected exit-from screen, followed by thumbnails of the application screens in the loop to which navigation can flow in one step from the selected screen. If the check box beside the selected exit-from screen is selected then a thumbnail of the Exit Flow screen is added to the thumbnails following the selected screen.
Click OK.
The loop recording is complete. The host editor performs the following actions:
It creates new flow nodes and other artifacts and stores into them a complete description of the recorded loop (see Recorded loop: Non-iterative case).
It disables the Exit Loop icon
to show
that the loop recording is complete.
It enables the Stop Flow Recording icon
to indicate that flow recording is reenabled.
Flow recording resumes starting with the currently displayed application screen, which is the Exit Loop screen.
When you select the check box Extract data every iteration of the loop for an Extract action in a recorded loop and specify a variable (for example, a variable named PartNumbers) in the usual way, then optionally for the Exit Loop screen of the same loop you can create an Extract action that stores text into the final available instance of the same variable (PartNumbers), as if the Exit Loop screen was an additional iteration of the loop.
This feature is useful when you are recording a loop that extracts text from the screens of a multipage list and the application screen that you want to use as the Exit Loop screen also displays the last page of data from the list.
To use this feature:
Begin recording the loop in the usual way.
Continue recording the loop in the normal way. After you have finished recording the loop (that is, after the Exit Flow Loop window closes) the Exit Loop application screen is still displayed.
If you create an Extract action for the Exit Loop screen and you do not want to add the text to the same variable that you store text into during the loop, then do not select the check box Extract data every iteration of the loop and do not select the same variable.