HomeStartingEnvironmentDBMSVisualPQLProceduresSQLFormsHost/APIIndex
Forms homecontents start chapter top of pagebottom of pagenext page index Screens

Screens

A screen definition starts with one of the
RECORD, TABLE or MENU commands. Within a screen there are then commands to compute data, to display fields, to control the appearance of the screen and to link to other screens.

A screen in this sense is not necessarily a display which fits on one window. A screen can be broken up into pages which do correspond to a single window. If more lines are specified on a screen than fit on the window, then the screen will be displayed in pages or pages can be defined explicitly. Screens do not scroll.

The sequence of the commands within the screen definition determines the order in which the cursor moves and the sequence in which the commands are executed (the "flow of control"). If screen positioning clauses are used, this may not necessarily be the "natural" order of fields as they appear on the screen.

The command names the screen and screen names must be unique within a form.

The set of commands for a screen must end with the appropriate END command; ENDMENU, ENDRECORD or ENDTABLE.

The main difference between the screens defined by RECORD, TABLE and MENU commands is that record screens access data from a single record in a database whereas table screens access data from a single row in a table. Menu screens do not access any external data. All screen types have access to any temporary variables defined in the form.

The syntax for the commands is the same except that AUTOWRITE only applies to RECORD and TABLE screens.

homecontents start chapter top of pagebottom of pagenext page index

MENU

MENU screenname
A menu screen starts with the MENU command followed by the screen name and finishes with ENDMENU. Within a menu screen, other commands can be used, however FIELD commands can only refer to temporary variables not to database or table variables.

Menu screens may consist simply of choices as to which screens to go to or a menu can be a complete data entry screen providing that it only refers to temporary variables. These can then be passed to record or table screen to write the data.

See syntax.

homecontents start chapter top of pagebottom of pagenext page index

RECORD

RECORD screenname [/database.record]
A record screen starts with the RECORD command and ends with ENDRECORD.

Specify the command RECORD followed by the name of the screen and, optionally, the name of the record and the name of the database. If a record name is not specified, the screen name must be the record name. If a database name is not specified, the first database defined on the FORM command is the default.

The same record type can be associated with multiple screen definitions in the same form definition to allow different ways of viewing the same data. Each screen name must be unique.

Record screens access and display one record at a time. Once control has been passed to a record screen, a record can be retrieved or a new entry created. The user can enter the key fields to locate the record, or can find the appropriate record or row with commands such as FIRST, LAST, NEXT or PREVIOUS. If the record or set of records to be retrieved has been determined in a previous screen, this information can be passed down with the CALL command.

Within a screen, commands can reference any variable from that record plus any temporary variables. Commands can also reference variables from the CIR on record screens in a case structured database.

See syntax.

homecontents start chapter top of pagebottom of pagenext page index

TABLE

TABLE screenname [/tabfile.table] [ INDEXED BY indexname ]
A table screen starts with the TABLE command and ends with ENDTABLE.

Specify the command TABLE followed by the name of the screen and, optionally, the name of the table and the name of the tabfile. If a table is not specified on the TABLE command, the screen name must be the table name. If a tabfile is not specified, the default tabfile is the first tabfile defined on the FORM command.

An index can be specified for a table and the index variables are treated as the key fields. The index variables must appear first on the screen. Only one index can be specified for a table screen. If an index is not specified, the default access mode is Search and the table is processed sequentially.

The same table can be associated with multiple screen definitions in the same form definition to allow different ways of viewing the same data. Each screen name must be unique.

Table screens access and display one row at a time. Once control has been passed to a table screen, a row can be retrieved or a new entry created. The user can enter the key fields to locate the row, or can find the appropriate row with commands such as FIRST, LAST, NEXT or PREVIOUS. If the row or set of rows to be retrieved has been determined in a previous screen, this information can be passed down with the CALL command.

Within a screen, commands can reference any variable from that table plus any temporary variables.

See syntax.

homecontents start chapter top of pagebottom of pagenext page index

Syntax

The clauses for RECORD, TABLE and MENU commands are:

Clauses:

ACCEPT (condition) 'error message',[OPTIONAL] ...
REJECT (condition) 'error message',[OPTIONAL] ...
[NO]AUTO WRITE
FINAL COMPUTE variable=expression, ...
INITIAL COMPUTE variable=expression, ...
KEEP
PRELOAD
RECEIVING variable, ...
STOPSCREEN
USERS GROUP name ACTIVITIES permissions

General Clauses

ACTIVITIES permissions
AT [ r ] [, c ]
[NO]AUTOTAB
BOTTOM n
CLEAR 'c'
DATA HILITE | VIDEO options
ERROR number [ VIDEO options ] 'error text' , ....
PAD [n][,m]
PAGESIZE [r][,c]
PROMPT HILITE | VIDEO options

homecontents start chapter top of pagebottom of pagenext page index

ACCEPT

ACCEPT (condition) 'error message' , ... [ OPTIONAL ]
ACCEPT specifies one or more checks to be performed before the user "moves away" from a screen. Moving away from a screen means retrieving a new record on this screen, calling another screen or returning to the screen that called this one.

If an ACCEPT expression is not true, the specified message is displayed and the cursor returns to the first input field. If a message is not specified, a default message is used. If both ACCEPT and REJECT are specified, the ACCEPT is actioned first and records must meet all specified criteria in order to be accepted.

Only one ACCEPT clause can be specified on a command.

Specify the keyword OPTIONAL after all conditions to allow the user to override the warning. OPTIONAL applies to all the specified conditions.

Specify the BOOLEAN clause on the FIELD command to test individual fields. This is the preferred practice for testing individual fields since the cursor is then positioned on the field in error.

Example: To leave the screen only when DATE2 is equal to or greater than DATE1 specify:
ACCEPT (DATE2 GE DATE1) 'Invalid dates .. Please re-enter'

homecontents start chapter top of pagebottom of pagenext page index

AUTO WRITE

[NO]AUTO WRITE
AUTO WRITE specifies that a new record is written when the user moves away from the screen. If NOAUTO WRITE is specified, a prompt is issued for permission to write the record.

If the user issues an explicit WRITE command, the setting of AUTO WRITE has no effect.

Moving away from a screen means retrieving a new record on this screen, calling another screen or returning to the screen that called this one.

homecontents start chapter top of pagebottom of pagenext page index

FINAL

FINAL COMPUTE   variable = expression, ...
      IF (expression)  variable = expression, ...
Specifies computations which are done when the user moves away from a screen. Moving away from a screen means retrieving a new record on this screen, calling another screen or returning to the screen that called this one.

Regardless of the number of variables to be computed, only specify the keyword FINAL once. The computations are performed before any ACCEPT or REJECT.

Variables can be computed with COMPUTE or conditionally computed using IF. Multiple COMPUTE and IF statements can be specified. Use a comma to separate expressions. An expression can be enclosed in parentheses.

Example: To compute the sum of VAR1, VAR2 and VAR3 on exit from the screen, specify:
FINAL COMPUTE TOTAL = VAR1 + VAR2 + VAR3

homecontents start chapter top of pagebottom of pagenext page index

INITIAL

INITIAL COMPUTE  variable = expression, ...
        IF (expression)  variable = expression, ...
Specifies computations which are done when the user first moves to the screen. Regardless of the number of variables to be computed, only specify the keyword INITIAL once. The INITIAL computations are performed before the first command in the screen and before a record or row is accessed.

Variables can be computed using COMPUTE or conditionally computed using IF. Multiple COMPUTE and IF statements can be specified. Use a comma to separate expressions. An expression can be enclosed in parentheses.

Example: To set the global variable TIME to the current time when a screen is accessed, specify:
INITIAL COMPUTE TIME=NOW(0)

homecontents start chapter top of pagebottom of pagenext page index

KEEP

Specifies that once this screen is accessed, it remains in the screen cache. See
parameters for information on the NUMSCR parameter on the execution statement.

homecontents start chapter top of pagebottom of pagenext page index

PRELOAD

Specifies that the screen is put in the screen cache as soon as the form is loaded.

homecontents start chapter top of pagebottom of pagenext page index

RECEIVING

RECEIVING variable, ...
Specifies a list of variables in the screen that are to receive values from the calling screen. These values are specified on the PASSING clause on the CALL statement in the calling screen. The variables in the Passing/Receiving list are matched by position. That is, the first variable in the passing list corresponds to the first variable in the receiving list, the second variable in the passing list corresponds to the second variable in the receiving list, etc.

Values that are "received" are DISPLAY fields and cannot be modified.

When creating a new record, RECEIVING forces a value into the variable. If an existing record is retrieved, all the record variables are set to the values from the database. This means that received data is overwritten and the only effect is to make the variable a DISPLAY field.

A screen may be called from more than one place. If a CALL does not pass any data, RECEIVING has no effect.

homecontents start chapter top of pagebottom of pagenext page index

REJECT

REJECT (condition) 'error message', ... [ OPTIONAL]
Specifies one or more checks performed before the user "moves away" from a screen. Moving away from a screen means retrieving a new record on this screen, calling another screen or returning to the screen that called this one.

If a REJECT expression is true, the specified message is displayed and the cursor returns to the first input field. If a message is not specified, a default message is used. If both ACCEPT and REJECT are specified, the ACCEPT is actioned first and records must meet all specified criteria in order to be accepted.

Only one REJECT clause can be specified on a command.

Specify the keyword OPTIONAL after all conditions to allow the user to override the warning. OPTIONAL applies to all the specified conditions.

The BOOLEAN clause on the FIELD command can be used to test individual fields. This is the preferred practice for testing individual fields since the cursor is then positioned on the field in error.

Example: To stay on this screen and not move away when DATE2 is equal to or greater than DATE1 specify:
REJECT (DATE2 GE DATE1) 'Invalid dates .. Please re-enter'

homecontents start chapter top of pagebottom of pagenext page index

STOPSCREEN

STOPSCREEN
Specifies that this is a "Stop" screen. The STOP command passes control back through any number of levels of calls to a stop screen. Multiple stop screens can be specified. A user can skip back over a series of screens instead of using the RETURN command in each screen. The root screen is a stop screen by default.

homecontents start chapter top of pagebottom of pagenext page index

USERS

USERS GROUP name ACTIVITIES permissions
Specifies whether particular user groups can access this screen and what activities are allowed.

Regardless of how many groups are defined, only specify the keyword USERS once. The keyword GROUP is followed by the name of the group allowed to access the screen and the permissions allowed. To restrict activities on this screen for everyone regardless of the group, omit the keyword GROUP and the groupname. This specifies that all groups are allowed access to the screen to perform the given permissions. If USERS are specified for a screen, specify all groups that are permitted access to the screen; any groups omitted from the USERS clause are allowed no activities. The ACTIVITIES clause specifies the permissions for the group. (See activities for permissions).

If a USERS clause is specified on a screen, then for a group to be allowed to perform an activity:

Example: Allow only group LOOK to access the Menu screen SUBMENU.
MENU SUBMENU USERS GROUP LOOK

homecontents start chapter top of pagebottom of pagenext page index