TOPIC: PHASES [ USING VPLUS/V AN INTRO. TO FORMS DESIGN Self-Paced Training Guide ] MPE/iX 5.0 Documentation
USING VPLUS/V AN INTRO. TO FORMS DESIGN Self-Paced Training Guide
TOPIC: PHASES
Statements entered in the Processing Specifications area of the Field
Menu can be executed in any of three phases: an initialization phase, a
field edit phase, and a final phase. Normally, all statements are
executed in the field edit phase. But, by the use of phase headers,
statements can be executed in either of the other two phases. The three
phase headers corresponding to the three possible phases of execution
are: INIT, FIELD, and FINISH. If any of these headers precedes a
statement or set of statements, those statements are executed in the
specified phase.
Basically, the phases determine when a statement is executed. The INIT
statements are executed before the form is displayed. The FIELD
statements are executed when ENTER is pressed and, unlike other
statements, may be executed again and again until all data is correct.
The FINISH statements are performed after all data has been accepted.
The rules governing phases are summarized in Table 6-2.
Table 6-2. Summary of Phases
--------------------------------------------------------------------------------------------
| | |
| Phase | Rules Governing the Phase |
| | |
--------------------------------------------------------------------------------------------
| | |
| INIT | All statements in this phase are performed before the form is |
| | displayed. |
| | |
| | No statements in this phase are executed in Browse mode. |
| | |
| | Any statements preceding a FIELD header are assumed to be in the |
| | initialization phase even if the INIT header is omitted. |
| | |
--------------------------------------------------------------------------------------------
| | |
| FIELD | Statements in this phase are performed after the operator types in |
| | data and presses the ENTER key. |
| | |
| | Statements are executed a field at a time, in screen order, until |
| | all fields have been processed. |
| | |
| | If corrections are entered for any field that has an error, all |
| | field edit phase statements are re-executed in screen order. |
| | |
| | Statements in this phase are executed in Browse mode, and all |
| | statements are re-executed when any change to a field is entered. |
| | |
| | |
| | Edit statements (see Section 4) must be executed in field edit |
| | phase. |
| | |
| | If there is no phase header, the field edit phase is assumed. The |
| | FIELD header must be specified only if there are initialization |
| | statements. |
| | |
--------------------------------------------------------------------------------------------
| | |
| FINISH | Statements in this phase are executed only when data entered in |
| | all fields in the form have passed the field edits. |
| | |
| | Statements in this phase are executed in Browse mode after field |
| | edit phase statements have been successfully executed. |
| | |
| | The FINISH header must always precede any statements in this |
| | phase. |
| | |
--------------------------------------------------------------------------------------------
Figure 6-7. Diagram of Phase Processing
Figure 6-7 illustrates graphically how processing is performed on a
single form in each of the possible phases. Remember that the
initialization phase processing is performed only if any field has
initial values, has processing statements preceding a FIELD header, or
has processing statements that are preceded by the heading INIT.
Statements to be processed in the final phase must be preceded by the
header FINISH. If there are no initial values or phase headings, all
processing is performed in the field edit phase whether or not the FIELD
header is specified.
Action
For a full discussion of this topic, read "Phases" in Section 4 of the
VPLUS/V Reference Manual.
Table 6-3. Specifications to Initialize Order Number and Date
----------------------------------------------------------------------------------------------
| | | |
| Form | Field | Processing Specifications |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| ORDER | ORDNUM | INIT |
| | | |
| | | SET ORDNUM TO SORD |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| | ORDATE | INIT |
| | | |
| | | SET ORDATE TO $TODAY |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| TOTALS | ORDNUM | INIT |
| | | |
| | | SET ORDNUM TO SORDNUM |
| | | |
| | | IF SORDNUM GT 999999 THEN SET SORDNUM TO 100001 |
| | | ELSE SET SORDNUM TO SORDNUM + 1 |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| | ORDATE | INIT |
| | | |
| | | SET ORDATE TO $TODAY |
| | | |
----------------------------------------------------------------------------------------------
MPE/iX 5.0 Documentation