Screens flow
Overview
This article describes several features that are unique to projects with screens, among which are:
- Wait for Screen - enables setting priorities for invoking several screens that follow an action step
- Variables - enables defining and using variables in a method flow involving screens
Flow tools for Screens
The Flow steps available for a project with screens are:
![](https://files.readme.io/9ad97507bd38853832275415c2e6da9eb372af0ba08ce73348ed145ac0744cb1-Screen_Flow_Steps.png)
The following steps are explained in the section Creating the Method Flow:
- Output - Adding fields to the method flow (This configures an output response of the flow. More than one output response can be configured.)
- Error - Add an error step to the method flow (This is the same as Output; Error just makes it visually clear that this is an error handling response.)
- Condition - Add a condition step to the method flow
- Expression - Add an expression step to the method flow
In a project with screens you can add Screen steps. Connecting two screens will create an action step. The action step represents the function key and input fields the user would fill in the legacy application to get from one screen to the next. For example, in the screenshot below, each of the Screen Key action steps ENTER, ENTER, F3, ENTER and PAGE_DOWN are followed by a Screen step.
![](https://files.readme.io/b581258c3b65219a81a5b8af3cd8c1ddf93ebe18b515f3ce897eada0ff5eb0ed-Screen_Action_steps.png)
Wait for Screen
In a method flow that includes screens, it is possible for an action step to be followed by several possible screens. For example, the below screenshot shows two possible screens that follow pressing of the Enter key: “ibm-i-main-menu” and “display-job-status-attributes”.
However, sometime we may want the flow to wait for one of the expected screens , and only if it did not arrive after a set amount of time , "settle" on the which ever expected screen we did end up on.
![](https://files.readme.io/ba7e95e95f07c8e1ca64a4f310ddf873a1f5895d922cdfa0a36d281019270a3a-Expected_screens.png)
-
To enable setting priorities for which screen we would like to wait for after the user presses the Enter key, press the Screen Timeout button
.
-
The Preferred Screen Timeout window opens:
-
You can set the wait time for one of the expected screens.
- Check the Enable box.
- Select a screen.
- Enter the Timeout value in milliseconds.
- Press Save.
-
After enabling Screen Timeout, the Screen Timeout button changes color to orange:
Variables
In a project with screens, the user can define variables to be used in the method flow. The following example demonstrates how variables can be used.
The screenshot below displays a flow in which Any Screen Step is followed by one of two possible actions:
- Case1 - if this is reached, the Output step follows with status code 200.
- Otherwise - if this is reached, return to Any Screen Step.
![](https://files.readme.io/4331367a0f754931f4033cdeb3de57c317dad3665920650ec43a0ed32929466e-Variables_1.png)
-
The user wants to take into account the possibility that Case1 is never reached, and therefore defines an Error step for that option.
-
Now the user clicks on Variables to open the Variables definition pane.
-
An integer variable named “counter” is defined with an initial value of 0. Next, the variable “counter” is mapped from the Input to the Output.
-
An expression is created to evaluate the “counter” by clicking on Add an Expression.
-
The variable “counter” is defined to be incremented by 1 each time.
-
A Condition is added to the flow.
-
Now the flow logic is completed by defining a logical loop.
The loop logic is:
- First, we evaluate which screen we are on in the top condition.
- If we reach the main menu screen (Case1), the program flow goes to the Output step and returns status code 200.
- Otherwise, we evaluate the "counter" variable:
- If “counter” is less than 20, “counter” is incremented by 1 and the program flow returns to the Any Screen Step.
- If “counter” equals 20, we “break” the loop and the program flow goes to the Error step and returns status code 500.
Updated 4 months ago