![]() | ||
| VISUALPQL | ![]() ![]() ![]() ![]() | PQLForms |
A Form can be created and maintained completely through the Forms Painter and this is the recommended way to develop forms. However, it may be necessary to use PQLForms commands and this chapter describes the various commands available.
The PQLForms commands define what variables are on each screen or page of a screen, how they are displayed and edited, how the screen is to look, and how screens are linked together. A PQLForm has built in buttons and associated logic to allow the user to navigate through a set of records and to display, edit and insert data according to the database description. A developer can use all standard VisualPQL commands as necessary and these are executed at appropriate places in the form.
A PQLform can be re-compiled every time it is used or the compiled version of the form can be saved as an executable member on the procedure file. A PQLForm can also be compiled and saved as a sub-routine and can then be executed as part of another PQLform or standard retrieval. A PQLform is run in the same way as any other VisualPQL routine either directly or from a menu.
Once a form has been developed, it can be used by many people for data entry or for querying data.
A default form can be generated for a database and can be used directly to view, create, or delete records.
The form definition starts with the FORM command. This is similar to a RETRIEVAL/PROGRAM/SUBROUTINE command and can take all relevant clauses as per those commands plus PQLForms specific clauses. There are no required clauses on a FORM command. The entire form definition is terminated by the END FORM command.
The FORM command may be followed by any standard VisualPQL commands, (for example defining any local variables) and then optionally a CALL SCREEN command which transfers control to the named screen. The first SCREEN command begins definition of a screen. All further commands are in a screen definition. Definition of a screen is terminated by the END SCREEN command. Commands in the screen define the set of fields which are displayed which can be split into a number of separately displayed pages if necessary.
A form can contain any number of screens. Screens are linked to other screens with the CALL SCREEN command so that the user or the application can pass control at appropriate points. A single screen can be called from any number of different screens.
The standard VisualPQL commands up to the first SCREEN or CALL SCREEN command are executed and then execution starts with the first screen or called screen.
This keyword MENU, RECORD or TABLE on the SCREEN command specifies the type of screen being defined:-
Within each screen, further commands are used to describe the components of the screen and their individual behaviour and appearance. The most common of these is the FIELD command. This defines an individual variable, possibly displaying it on the screen allowing the user to retrieve data and maybe update data. Default formats and edit rules from the data dictionary are applied automatically. There are clauses on this command to extend the edit rules and alter the position or format of the data.
A form has a structure similar to the following:
FORM . SCREEN RECORD record_name . FIELD field_name . FIELD field_name . CALL SCREEN record__name1 . END SCREEN . SCREEN RECORD record_name1 . FIELD field_name . FIELD field_name . END SCREEN ENDFORMA very simple form definition (on the example
COMPANY database) might be:form . screen record EMPLOYEE . field id . field name . field currpos . call screen OCCUP . end screen . screen record OCCUP . field id . field position . field startsal . end screen end form
AT clause on the command which specifies the element.The visual size of the screen is determined by the maximum position taken by any display element plus space for buttons and an area to display messages. There is no absolute maximum row and column size and it is possible to create screens which are too big to view all at once.
EXAM2002 on the example COMPANY database. These are named FORMnnnn and contain comments as to the various features that they illustrate.
SCREEN
PAGE
FIELD
GENERATE
CALL SCREEN
ABUTTON
FBUTTON
FDISPLAY
END SCREEN
END FORM
FIELD command has the EDITIN and EDITOUT clauses which allow the specification of commands to transform data as it is read from the screen or displayed.
:
FIELD SALARY EDITOUT (fieldout = pformat(salary,'$zzzz.zz'))
EDITIN (if (sbst(fieldin,1,1) eq '$') fieldin = sbst(fieldin,2,len(fieldin)-1);
salary = numbr(fieldin);
ifthen (salary lt 1000);
failmess = 'Salary too low';
failfld = 1;
fi)
FIELD command has the IF clause which determines whether the field is enabled or disabled (greyed out).FIELD SALARY prompt 'Salary:' IF (EDUC EQ 1)
FIELD commands. The commands are executed when the user presses ENTER as follows:-FIELD command are executed whenever the user presses Enter.
FIELD command are executed when a user is positioned on that field and presses Enter (with a valid value) after the value from the screen is put into the variable but before the screen is redisplayed.
FAILFLD |
A numeric variable that can be set by commands that check a specific field as it is entered. A value of zero (0) is the default and means accept the field; a positive value means warn the user that the field has failed validity tests but they have the option to accept it; a negative value means the field has failed validity tests and is not accepted. The absolute numeric value has no specific meaning. The standard error message used if FAILFLD is not zero is number 57 'Failed Edit tests' and this can be overridden by setting a value in FAILMESS.
|
FAILMESS |
A string variable set by commands to the text of the message to display for a test that fails. If a positive FAILFLD or FAILSCR code is set, the text 'OK to save?' is appended to the message.
|
FAILSCR |
A numeric variable set by commands that check record validity. During field processing or in the WRITE clause, a zero value accepts the update and is set by default. A positive value means the user has the option to accept the update after a warning. A negative value means the update is not done. The absolute numeric value has no specific meaning. The standard error message used if FAILSCR is not zero is number 110 'Record failed write tests'.If a SELECT clause is specified on the SCREEN command, this can set FAILSCR to a non-zero value to indicate that the record should be skipped.
|
FIELDIN |
A string variable used as the starting point for data from the screen for any EDITIN commands to check or transform when the user presses Enter on that field.
|
FIELDOUT |
A string variable used as the result of any EDITOUT commands to display the field on the screen. |
HELP clause followed parentheses enclosing any standard PQL expression which resolves to a string. The expression can be a simple string constant in quotes or a concatenated string. To display multiple lines in the pop up box, concatenate char(13) as a line break character. For example:
FIELD BIRTHDAY
PROMPT 'Date of Birth'
HELP ('Enter as MMM DD, YYYY' + char(13) +
'For example: May 24, 2001')
If there is no defined help text for a field, nothing is displayed i.e. no box is popped. If there is no help text for any fields, the question mark is suppressed.
ERROR clause for the error message number at any level (form, screen, field). This replaces the default error message for everything within that level. For example:
FIELD SSN ERROR 47 'Social security number is in the wrong format'In this example, error message 47 "Not a valid value", is replaced by the message "Social security number is in the wrong format" if a user makes an error.
Every PQLForm screen has a set of buttons which take standard actions. These buttons vary according to the type of screen but all include an
Each data field can have up to three visual elements: a prompt, a data area to enter or to display the data and the set of value labels displayed as a pull down choice list. When a screen is initially displayed, fields may already have data in them or the fields may be blank waiting for data to be entered or a record to be retrieved.
To enter data into a field, type in the data and press
Keys to edit the field are the normal keys for the GUI being used. On Windows systems,
Press
If a screen is on multiple pages, the
To call a screen, press the appropriate button. The
There are buttons to browse through sets of records:-
To locate a record, enter data in all the key fields. Press Enter at the last key field and the matching record is then retrieved. If no record matches the exact key, a message that a no record has been found is displayed. This positions in the set of records even if a partial key is entered or the key does not exist and the Next or Previous buttons browse from that point.
Prior to writing the data back, the
These general clauses are:-
The absolute row and column size are dependent on the font size being used. A single row is sufficient to display a field or button. A column approximates to an average character in the font. The number of rows and columns displayable on a screen depend on font size and screen resolution.
Row and column positions can be specified in either absolute or relative terms.
Absolute positions are specified with unsigned integers. For example,
Relative positions are specified by prefixing the integer with a plus or minus sign. Relative positions are relative to the default position for this element. For example,
An asterisk (*) may be used instead of row or column numbers to indicate the default maximum row which is the current pagesize (default 20) or default maximum column (80).
Example
The physical width of any field depends on font sizes in use and, since most fonts are variable width, there is no exact correspondence between columns and characters that can be displayed. A column approximates to an average character in the font. If the displayed data or label is wider than the display width, the user can scroll horizontally with the right and left arrows.
Example: To display 20 characters of value labels next to all data fields that have value labels, specify:
Error messages apply to the level (
The
Using PQLForms
Run PQLForms as per any other VisualPQL program from the SIR2002 menus. Any database or tabfile required by a form must be connected.Exit button to return one level. Typically screens also have various fields for the display and entry of data. Error messages are displayed at the bottom of the screen.Enter. To skip over fields, use the Tab keys or position to a field with the screen cursor using a mouse or other pointing device. Shift-Tab goes back a field, Tab goes forward a field. Tab does not process the data nor execute any VisualPQL associated with the field.Field Editing Operations
When positioned to a data entry field, edit the contents of the field if necessary. Left Arrow and Right Arrow position the cursor within the field. The data in a field may be longer than the display space and is scrolled horizontally as characters are typed or the arrow keys are used.Del deletes the next character, Ctrl-Del deletes the whole field; Ctrl-C cuts highlighted characters, Ctrl-V pastes cut characters, Ctrl-Z restores the previous edit, etc.Enter to process the data in a field and move to the next field. If you update a field but do not press Enter, the edits have no effect.Moving from screen to screen
A form often consists of multiple screens, one per record type or table. A screen is a single logical entity which may be split into several pages if the data does not fit on a single display screen.Page Down button moves to the next page; the Page Up button moves to the previous page. The title of the screen changes to indicate the current page.Exit button returns to the calling screen. Lower level screens can call other screens and screens may be nested as deeply as necessary.Accessing Records and Rows
Key fields identify the record or row and are usually the first fields at the top of the screen. Key fields must be specified on a screen. If the complete set of key fields is not specified, a warning is given at compile time and the missing key fields are automatically added as the last fields on the screen.
If the screen is a top level screen, (it has not been called by another screen) then the set of records is all of the records of that type in the database or table. However, if a screen is called by other screens, then some part of the overall key may have been set by the calling screen. In this case, those key fields are read-only (cannot be modified) and the set of records is a subset with that specified part of the key. The browse buttons operate within that set of records i.e. The first button retrieves the first matching record in the subset not the first on the file.Updating a Record
Once a record is displayed, the data fields can be modified.
At the end of processing a screen (as the user retrieves another record or exits the screen), if the form allows updates and any of the fields have been updated, the record is written back. This can be done automatically or a message can be displayed asking the user to confirm that the record should be written.
At any point after updating some field(s), press the WRITE button to write the changed data. The WRITE button is only displayed if the form allows updates and is only enabled when some data has been updated.RESET button restores the original data "undoing" whatever changes were made.
The Clear button clears the screen data fields except for any key values preset by the CALL to this screen.Deleting Records
Once a record is displayed, the DELETE button deletes the record. The DELETE button is only displayed if the form allows updates and a record has been retrieved. The record is deleted after asking the user for confirmation.
PQLForms General Clauses
There are a number of settings or general clauses which can be specified at different levels and, if not over-ridden at a lower level, apply to all definitions within the level. Settings can be specified at the following levels:
FORM
SCREEN
PAGE
FIELD
A setting at one level acts as the default for all lower levels. For example, the width of labels could be set on the FORM command for the whole form and would apply to every field on every screen. A setting is overridden for a particular level by specifying the clause at that level. If a particular setting is not specified at a given level, the current default applies.
[NO]PROMPT [AT r,c] [WIDTH n]
[NO]DATA [AT r,c] [WIDTH n]
[NO]LABELS [AT r,c] [WIDTH n]
['prompt-string'|VARDESC|VARLABEL|VARNAME]
ERROR number 'error text'
Field Elements
There are three main elements to each field as displayed on the screen, from left to right, the Prompt, the Data and the Label.
VAR LABELS command). The default position for the prompt is one row down and in the same column as the previous prompt or other displayed element (text, button, etc.) and is 18 columns wide. The first prompt is in the top left corner, row 1 column 1.
FORM, SCREEN, PAGE and FIELD commands. (See below.) Because the three elements are positioned from left to right relative to each other, if the prompt position or width is specified, the data and label positions are automatically adjusted. Similarly, if the data position or width is specified, the label position is automatically adjusted.Screen co-ordinates
PQLForms uses a notional set of Row and Column co-ordinates to specify vertical rows and horizontal columns. The top row is 1 and the leftmost position is column 1.AT
AT [ row ] [, column ]
AT is a clause on a number of commands and alters the starting position for the specified display element.AT 5 positions at row 5, AT ,60 positions at column 60, AT 5,60 positions at row 5 column 60.AT -1,+40 specifies one row higher and forty columns to the right and means that the field appears on the same row as the previous field.AT clauses:
If AT 1,1 positions to the upper left corner.
AT *,1 positions at row 20, column 1.
AT ,12 positions at column 12 of the current line.
AT -1,1 positions at the beginning of the previous line.
AT ,+10 positions 10 columns along from the default column position.AT is specified on PROMPT, the default DATA and LABEL column positions are updated. Similarly, if AT is specified on DATA, the default LABEL column position is updated.WIDTH
WIDTH n
WIDTH is a clause on a number of commands and alters the width for the specified display element or the width of all lower level display elements of that type if specified on a higher level command.[NO]DATA
[NO]DATA [AT r,c] [WIDTH n]
Specifies position and/or width of the data area for fields.
AT
Specifies the starting position (row and column) of data area. If position is specified on a higher level command, it applies to the first field. If
AT is specified on DATA, the default LABEL column position is updated. WIDTH n
Specifies the width of data area. If
WIDTH is specified on DATA, the default LABEL column position is updated.NODATA
Suppresses the data area of the field. This also suppresses any label for the field.
[NO]LABELS
LABELS [AT R,C] [WIDTH n] | NOLABELS
Specifies position and/or width of the label area of a field. Labels correspond to value labels and are only displayed for fields that have value labels defined. Labels are displayed as a choice control. This is a pull down list with all allowed descriptions and the selected description corresponds to the value in the data field. Choosing a description updates the value in the data field.
AT
Specifies the starting position (row and column) of label area. If position is specified on a higher level command, it applies to the first field.
WIDTH n
Specifies that value labels, "n" characters wide, are displayed where appropriate.
NOLABELS
Suppresses the labels area of the field.
FORM TESTFORM LABELS WIDTH 20
[NO]PROMPT
[NO]PROMPT [ 'prompt-string' | VARDESC | VARLABEL | VARNAME] [AT r,c] [WIDTH n]]
Specifies how prompts for fields are displayed. Prompts are left justified and followed by a colon (:).
NOPROMPT suppresses the prompt. This does not alter the default start position of the associated data.prompt string
Specifies a prompt string for a field. This format can only be used when specifying prompt defaults on a specific
FIELD not on any higher level commands.VARDESC
Specifies that the variable name and label are the prompt.
VARLABEL
Specifies that the variable label is the prompt. This is the default.
VARNAME
Specifies that the variable name is the prompt.
AT
Specifies the starting position (row and column) of prompt area. If position is specified on a higher level command, it applies to the first field. If
AT is specified on PROMPT, the default DATA and LABEL column positions are updated.WIDTH n
Sets the width of the prompt. If
WIDTH is specified on PROMPT, the default DATA and LABEL column positions are updated. ERROR
ERROR message_number 'error_text'
Specifies alternate text for a message. Each message consists of the message_number followed by text. See
messages for a full list of default messages.
FORM, SCREEN, PAGE or FIELD) at which they are defined and to all lower levels unless overridden by another error message defined at the lower level.
Example: To change the messages for errors 15 and 47 to "This field must be two digits." and "Jobcode must be between 10 and 60.", specify:
FIELD JOBCODE ERROR 15 'This field must be two digits.'
ERROR 47 'Jobcode must be between 10 and 60.'
FORM
FORM
[appropriate standard RETRIEVAL/PROGRAM/SUBROUTINE clauses]
[PQLForms general clauses]
[AUTO]
[CLEAR|NOCLEAR]
[PAGESIZE rows]
[PQLFILE='filename']
[SUBROUTINE name [(input_list)]]
[UPDATE]
General Clauses
[NO]DATA [AT r,c] [WIDTH n]
[NO]LABELS [AT r,c] [WIDTH n]
[NO]PROMPT [AT r,c] [WIDTH n] [VARDESC|VARLABEL|VARNAME]
ERROR number 'error text'
FORM command is required. All other clauses are optional. All standard RETRIEVAL clauses can be specified. The PQLForms general clauses can be specified. The following specific clauses can be specified on the FORM command:
AUTO |
Specifies that, if updates are allowed, any new records are written to the database without asking for confirmation. NOAUTO specifies that the user is asked to confirm that the record should be written and is the default. |
CLEAR |
Specifies that, if updates are allowed, the data fields on the screen are cleared after writing. NOCLEAR specifies that the data is not cleared and is the default. |
PAGESIZE n
|
Specifies the maximum number of data rows in a page of a screen. The default is 20. (See the PAGE) command. |
PQLFILE |
Specifies that the named file is created. This contains standard VisualPQL code (i.e. all PQLForms extensions have been replaced) which performs identical functions to the specified form. This can be used as the basis for a program with other functionality if necessary. |
SUBROUTINE |
Specifies that the routine is compiled and saved as a SUBROUTINE. The subroutine name is required and is the name of the compiled subroutine. The name of the subroutine can be qualified with procedure file and family prefixes and passwords.
A subroutine may have input parameters. These are
positional parameters corresponding to the |
UPDATE |
Specifies that record and table screens allow the reading and writing of records. By default, screens do not update the database or tabfile. Individual screens can be set to allow/disallow updates. Local variables can be input regardless of update status. |
A
Follow the screen command with further commands to display fields, to control the appearance of the screen or to link to other screens. The sequence of the fields within the screen definition determines the order in which the commands are executed. If the display element positioning clauses are used, this may not necessarily be the order of fields as they appear on the screen.
End the set of commands for a screen with the
There are three screen types defined by the
The
Specify the screen name 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 current database is the default.
The special name
An index can be specified for a record and the index variables are treated as the key fields. Only one index can be specified for a record screen. If an index is not specified, the record is processed by any case and record keys.
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.
When control is 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 with
Specify the screen name and, optionally, the name of the table and the name of the tabfile. If a table is not specified, the screen name must be the table name. If a tabfile is not specified, the default tabfile is used.
An index can be specified for a table and the index variables are treated as the key fields. Only one index can be specified for a table screen. If an index is not specified, the table is processed sequentially.
The same table can be associated with multiple screens in the same form definition to allow different ways of viewing the same data. Each screen name must be unique.
When control is 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
SCREEN
SCREEN
{MENU name |
RECORD name [/database.record][ INDEXED BY indexname ] |
TABLE name [/tabfile.table] [ INDEXED BY indexname ]}
[ALIAS localname = column_name]
[AUTO|NOAUTO]
[CLEAR|NOCLEAR]
[DELETE (pql code)]
[INITIAL (pql code)]
[NOBUTTON]
[PAGESIZE rows]
[READ (pql code)]
[SELECT (pql code)]
[UPDATE | NOUPDATE]
[WRITE (pql code)]
General Clauses
[NO]DATA [AT r,c] [WIDTH n]
[NO]LABELS [AT r,c] [WIDTH n]
[NO]PROMPT [AT r,c] [WIDTH n] [VARDESC|VARLABEL|VARNAME]
ERROR number 'error text'
SCREEN command starts a screen definition. The screen name must be specified and must be unique within a form. This is displayed as the title of the screen. The name can be up to 32 characters. If the name is not a valid SIR 32 character name, (e.g. it contains blanks), enclose the name in quotes.END SCREEN
command.MENU, RECORD or TABLE keyword.MENU
Within a menu screen, FIELD commands can only refer to local variables. Menu screens may consist simply of buttons offering choices as to which screens to go to or can display fields or allow data entry providing that these are local variables.AUTO, READ, SELECT and WRITE clauses do not apply to MENU screens.
RECORD
Record screens access and display one record at a time. Within a screen, commands can reference any variable from that record plus any local variables. Commands can also reference common variables in a case structured database.CIR can be used as a record name on a case structured database to refer to the common information record.FIRST, LAST, NEXT or PREVIOUS buttons. The record or set of records to retrieve can be determined by clauses on the CALL SCREEN command.TABLE
Table screens access and display one row at a time. Within a screen, commands can reference any variable from that table plus any local variables.FIRST, LAST, NEXT or PREVIOUS buttons. The row or set of rows to retrieve can be determined by clauses on the CALL SCREEN command.Clauses
ALIAS localname = column_name
|
Specifies a local name which obeys VisualPQL naming rules (up to eight characters, etc.) as an Alias for a field name in a table screen which does not obey these rules. It is only necessary to specify an alias if you need to refer to the field in some VisualPQL code either in a clause or in-line on this screen. If the long field name contains blanks or lower case letters, enclose the name in quotes.
SCREEN TABLE MYTABLE
ALIAS myvar1 = "Employee Identification"
ALIAS myvar2 = "Employee Salary"
SELECT (IF (MYVAR1 LT 0) FAILSCR = -1;
IF (MYVAR2 LT 2500) FAILSCR = -1)
|
AUTO|NOAUTO
|
Specifies that any new records are written to the database without asking for confirmation. NOAUTO specifies that the user is asked to confirm that the record should be written and is the default.
|
CLEAR |
Specifies that, if updates are allowed, the data fields on the screen are cleared after writing. This is the default if not set at the FORM level. NOCLEAR specifies that the data is not cleared. |
DELETE (PQL Code) |
Specify VisualPQL code, enclosed in brackets, which is executed when a record or row is about to be deleted. The record (row) is deleted by the user pressing the DELETE button. The VisualPQL can be any set of commands. The executed code can create and display sub-dialogs or error boxes as necessary. Separate multiple commands with a semi-colon ';'.The DELETE commands can set a value in FAILSCR to warn the user and reject the delete.Example: To test that when employee has a current position, tell the user and ask whether to accept the delete:
SCREEN RECORD EMPLOYEE
DELETE (IFTHEN (EXISTS(CURRPOS));
COMPUTE FAILSCR = 15;
COMPUTE FAILMESS='Employee in current position';
FI)
|
INITIAL (PQL Code) |
Specifies VisualPQL code, enclosed in brackets, which is executed when the user first initiates a screen before anything is displayed, before the first command in the screen and before a record is accessed. The set of VisualPQL to execute is any set of commands but should not display any sub-dialogs or any other graphical elements. Separate multiple commands with a semi-colon ';'. Example: To set the local variable INTIME to the current time when the screen is accessed, specify:SCREEN RECORD EMPLOYEE INITIAL (COMPUTE INTIME=NOW(0)) |
PAGESIZE n
|
Specifies the maximum number of rows in a page of a screen. The default is 20. If the number of rows on a screen exceeds this size, then a new page is created automatically. When a screen has multiple pages, each page is displayed separately, the Page Up/Page Down buttons are displayed and the screen title contains the current page number. There is no limit to the number of pages on one single screen. All pages within a screen are the same size visually. All pages within a screen are one logical entity i.e. record and table screens access one single record or row. Page breaks can be set specifically at given points by the PAGE command.
|
READ (PQL Code)
|
Specify VisualPQL code, enclosed in brackets, which is executed when the user reads a record. The code is executed when a new record is retrieved, after the record is read and before the data is displayed. The VisualPQL can be any set of commands. The executed code can create and display sub-dialogs or error boxes as necessary. Separate multiple commands with a semi-colon ';'.
|
SELECT (PQL Code)
|
Specify VisualPQL code, enclosed in brackets, which is executed as the user moves to another record. The code is executed after a record is read and selects whether this record is wanted. The VisualPQL can be any set of commands which eventually set FAILSCR to non-zero if the record is not wanted. Records that are not wanted are skipped and the user is presented with the next wanted record. Separate multiple commands with a semi-colon ';'.Example: To ignore records where salary is under 2500, specify: SCREEN RECORD EMPLOYEE SELECT (IF (SALARY LT 2500) FAILSCR = -1) |
[NO]UPDATE |
UPDATE specifies that this record or table screen allows the reading and writing of records. NOUPDATE specifies that this record or table screen does not allow the reading and writing of records. By default, screens are set to the update status of the form. Local variables can be input regardless of update status. |
WRITE (PQL Code)
|
Specify VisualPQL code, enclosed in brackets, which is executed when a record or row is written. If data has been updated, the record (row) is written directly by the user pressing the WRITE button or when the user retrieves a new record (row) on this screen or exits from the screen. The code is executed after all local variables have been set to the values displayed on the screen.
The VisualPQL can be any set of commands. The executed code can create and display sub-dialogs or error boxes as necessary. Separate multiple commands with a semi-colon ';'.The WRITE commands can check the validity of a record (row) and can set a value in FAILSCR to warn the user and reject the write.Example: To compute the sum of VAR1, VAR2 and VAR3, specify:SCREEN RECORD EMPLOYEE WRITE (COMPUTE TOTAL = VAR1 + VAR2 + VAR3)To test that when salary is greater than 5,000, tell the user and ask whether to accept the record:
SCREEN RECORD EMPLOYEE
WRITE (IFTHEN (SALARY GT 5000);
COMPUTE FAILSCR = 15;
COMPUTE FAILMESS='Salary over $5,000';
FI)
|
END SCREENA screen must be ended with the
END SCREEN command. There are no further clauses on the command.
There is no limit to the number of pages on one single screen. All pages within a screen are one logical entity related to one single record or row.
If any of the general clauses are specified, these apply to the first field on the page.
If the row placement for a field or button would exceed the page size, a new page is created, the row is reset to the default row for a page (1 if not specified) and subsequent display elements are included in this new page. Lines, boxes and other elements specified with
The page size is checked after any positioning clauses are processed and a new page is created if necessary.
The only required clause on the
The
The sequence of the
The
If VisualPQL commands are interspersed with
The
The only required clause on the
The default prompt is the called screen name.
A called screen can be blank for the user to enter any keys and retrieve any records or rows, or the key fields can be passed by this command to control the set of records or rows that the called screen is to reference.
The data fields on the called screen may be blank for the user to select the required screen (first or last in the set) or a record or row may be retrieved automatically with an
Specify a VisualPQL condition (enclosed in brackets) that controls whether the screen is called at this point. If the condition is true, the screen is called.
If the user requests help, the string is displayed as a pop up box.
If a
If a
The
The
button_name
The
The general clauses on the
For example, to specify particular options for three fields and then bring in all the remaining fields in the
PAGE
PAGE
[PAGESIZE rows]
General Clauses:
[NO]DATA [AT r,c] [WIDTH n]
[NO]LABELS [AT r,c] [WIDTH n]
[NO]PROMPT [AT r,c] [WIDTH n] [VARDESC|VARLABEL|VARNAME]
ERROR number 'error text'
The PAGE command specifies that a new page begins at this point. A new page resets the row position of the next display item to the top of the screen. When a screen has multiple pages, the Page Up/Page Down buttons are displayed and the screen title contains the current page number.Clauses
PAGESIZE n
Specifies the maximum number of data rows in a page of a screen. The default is 20. If the screen has less rows than the page size, then the dialog is the minimum size to accommodate the visual elements.
FDISPLAY commands do not trigger automatic paging.PAGESIZE n can be specified on the FORM command, on a SCREEN command or on a PAGE command.
FIELD
FIELD variable_name
[EDITIN (pql commands)]
[EDITOUT (pql commands)]
[HELP (help string expression)]
[IF (pql condition)]
[NOECHO]
[READONLY]
[TYPE [INTEGER | STRING | REAL | DATE | TIME]]
General Clauses:
[NO]DATA [AT r,c] [WIDTH n]
[NO]LABELS [AT r,c] [WIDTH n]
[NO]PROMPT [AT r,c] [WIDTH n] ['prompt-string'|VARDESC|VARLABEL|VARNAME]
ERROR number 'error text'
The FIELD command displays the current value of a variable on the screen and provides the capability to invoke standard PQL for editing and validating data values.FIELD command is the name of the variable. A FIELD command without any clauses displays the data at a default position on the screen using the dictionary definitions to control the prompt, the data format and the edit rules.FIELD command is used in record screens for record variables, in table screens for table columns and in any screen for local variables. The same variable can be referenced by multiple FIELD commands on a screen.FIELD commands determines the sequence followed by the cursor on the screen when the user presses Enter or uses the Tab keys. Field commands do not have to correspond to the sequence of variables in a row or record. All of the fields on a record or table do not have to be on a screen.FIELD command creates visual entries in the screen together with appropriate logic to display and modify the data.FIELD commands then:
FIELD in a screen are executed whenever the user presses Enter;
FIELD are executed when a user is positioned on that field and presses Enter.Clauses
EDITIN (pql commands)
Specify VisualPQL code, enclosed in brackets, that takes the value from the special string variable
FIELDIN and sets the value of the record, row or local variable. Separate multiple commands with a semi-colon ';'.
Example: A field (named SSN) for entering a social security number may be displayed with hyphens. The following removes these:
FIELD ssn EDITIN (COMPUTE ssn = REPLACE (fieldin,'-','',LEN(fieldin),1,0))
If the EDITIN commands check the validity of a field, set a value in a special variable, FAILFLD, to indicate what is to be done with the field. A value of zero (0) is the default and means accept the field; a positive value means warn the user that the field has failed validity tests but they can choose to accept it; a negative value means the field has failed validity tests and is not accepted. The standard error message is number 57 'Failed Edit tests'. Set the value of the string variable FAILMESS to display a different message for the test that fails. If a positive error code is set, the text 'OK to save?' is appended to the message.EDITIN commands completely replace the default field assignment and validation so your PQL code must assign a value to the variable named in the FIELD variable_name.EDITOUT (PQL commands)
Specify VisualPQL code, enclosed in brackets, that alters the way the field is displayed. The specified commands would typically be a function or set of functions which use the field as the input and create the special string output field
FIELDOUT. The form then uses this as the field displayed in the screen. Separate multiple commands with a semi-colon ';'.
Example: To display a social security number in the format ddd-dd-dddd:
FIELD SSN EDITOUT (compute fieldout = edit (ssn,"^^^-^^-^^^^"))
N.B. If the user just edits the field then any characters added or taken out by this process become the input. This must be dealt with, either by the user clearing the field when editing or by appropriate logic in the EDITIN command.
HELP (string expression)
Specifies a text string or expression to display when help for a specific field is requested by the user. When the user requests help, the string expression is resolved and displayed as a pop up box.
IF (pql condition)
Controls whether a field is enabled or disabled (greyed out). All fields are normally enabled. The specified condition is tested every time the data in the screen is updated and the field is enabled if the condition is true otherwise it is disabled.
Example: Allow monthly rent to be entered if OWNHOME is not equal to 1.
FIELD MONRENT IF (OWNHOME NE 1)
NOECHO
Makes the field protected which means that the user does not see the characters in the field as they are entered or displayed. Depending on the specific operating system, the characters are replaced with asterisks or blanks.
READONLY
Specifies that the field is read only. It cannot be modified nor can new data be entered.
TYPE
When specifying local variables on a
FIELD command, the TYPE specifies the type of field being referenced. By default, the type is INTEGER. The local variable should also be defined using standard PQL in the beginning of the form.
CALL SCREEN
CALL SCREEN screen_name
The
[AT r,c]
[AUTO [(pql condition)]]
[HELP (help expression)]
[IF (pql condition)]
[ONCALL FIRST | LAST]
[PROMPT 'prompt']
[USING (caseid,*| key,...)
[VIA (* | key,...)
[WIDTH n]
CALL SCREEN command passes control from one screen to another, typically when the user presses the button generated by the command.CALL SCREEN is the called screen_name. This references another screen that is included in this form. If the name is a non-standard name, enclose it in quotes and ensure that it exactly matches the screen name as specified on the called screen.ONCALL FIRST or ONCALL LAST clause.Clauses
AT
Specifies where on the screen the
CALL SCREEN button is displayed.AUTO [(pql condition)]
Specifies that screen is called automatically when the user presses Enter on the previous field. The
AUTO option suppresses the display of a button and does not affect the position of subsequent fields. The visual clauses AT, PROMPT and WIDTH thus have no effect. If the user needs a normal button to choose to call the screen, specify a second CALL command.HELP (string expression)
Specifies a string expression to display when help is requested by the user when positioned at the
CALL SCREEN field.IF (PQL condition)
Controls whether the button is enabled or disabled (greyed out). Call buttons are normally enabled. The condition is tested every time the data in the screen is updated and the button is enabled if the condition is true, otherwise it is disabled.
CALL NEXTOFKIN IF (RELATIVE = 1)ONCALL FIRST | LAST
Specifies that either the
FIRST or LAST record in the set of records available to the called screen is retrieved and displayed automatically.PROMPT 'string'
Specifies the label on the button. If a
PROMPT is not specified, the name of the called screen is used.
USING (list,...)
Specifies a list of variables that the called screen uses as keys to a different case on a case structured database. Specify the case id value, optionally followed by the key field values.
Example: To call a screen INDEX which references a new case with a case id of -1 and two other keyfields:
CALL INDEX USING (-1,NAME,ID)
VIA (list, ...)
Specifies a list of variables that the called screen uses as keys. Use
VIA to select records within this case, to access other records on a caseless database or to access a SCREEN TABLE. Do not specify a case id on the VIA clause. Do not use USING and VIA on the same CALL SCREEN command.CALL is within a SCREEN RECORD the key specification for either USING or VIA keys can contain an asterisk (*) indicating that the key fields of the record from the current screen are used. The asterisk can be preceded or followed by other values. If an asterisk is preceded by values, these values are used positionally. e.g. If a record has three keys, the expression (1,*) means use '1' as the first key and take the second and third key values from this record.
If an asterisk is followed by values, the values are used positionally after the number of keys in the calling record. e.g. If the current record has three keys, the expression (*,1) means use the first, second and third keys from this record and use '1' as the fourth key (presumably the record being called has at least four keys).
If one or more of the lower level keys are omitted, all records with the specified keys are accessible.CALL is within a SCREEN RECORD and a USING or VIA clause is not specified, all higher level keys are passed automatically which is equivalent to USING (*) or VIA (*).WIDTH n
Specifies the width of the
CALL SCREEN button.
FDISPLAY
FDISPLAY
[AT r,c]
[[DRAW [HEIGHT N] [IMAGE (bitmap_filename_expression) [BORDER]]]
[TEXT (text_expression)]
[WIDTH n]
The FDISPLAY command puts a line, box, image or text on the screen. Expressions are evaluated and the display updated when the screen is refreshed (e.g. when a new record is read).AT
Specifies a start position. The default start position is the current default
PROMPT start position.DRAW
Creates vertical and horizontal lines and boxes. Lines and boxes avoid the exact placements of fields so the same row column references as fields can be used to group sets of fields visually. Lines and boxes do not alter the default position for the next field.
WIDTH specifies how wide the line/box is and HEIGHT specifies how high the line/box is. If the height is zero (or unspecified), a horizontal line is produced. If the width is zero (or unspecified), a vertical line is produced. If both width and height are specified, a box is produced.IMAGE clause specifies an expression which is resolved to the name of a bitmap file and the image from this is displayed in the box. The BORDER clause puts a border around the image. If an image is displayed, the default position is updated by the height of the image.TEXT
Specifies a text expression which is resolved and displayed as text. The default position is updated by the standard single row. The
For example:WIDTH specifies how wide the text is. The default is the current default PROMPT width.
FDISPLAY TEXT ('Welcome to the Administration System') WIDTH 30
FDISPLAY TEXT ('Please contact ext. 123 for help') at +2,+5
FDISPLAY TEXT (NAME) AT 4,30 WIDTH 20 | Displays value in variable NAME
FDISPLAY DRAW WIDTH 80 | Draws line for 80 columns
FDISPLAY AT 1,1 DRAW HEIGHT 10 WIDTH 50 | Draws box
FDISPLAY DRAW HEIGHT 5 WIDTH 40 IMAGE ('LOGO.BMP') | Displays image from file
ABUTTON
ABUTTON {FIRST | LAST | NEXT | PREVIOUS | EXIT | RESET | WRITE | CLEAR | DELETE | PAGEDOWN | PAGEUP} ABUTTON command is equivalent to the user pressing a button, except that it is done under program control. This command can be used anywhere in-line VisualPQL can be used but cannot be used in clauses on other PQLForms commands.FIRST
Gets the first record for this screen.
LAST
Gets the last record for this screen.
NEXT
Gets the next record for this screen.
PREVIOUS
Gets the previous record for this screen.
EXIT
Returns to the calling screen or exits from the form if this is the top screen.
RESET
Restores all the record or table variables to their original values.
WRITE
Writes the record or row to the database or tabfile.
CLEAR
Clears all data fields and any key fields which are not preset by a calling screen.
DELETE
Deletes the record or row from the database or tabfile.
PAGEDOWN
Displays the next page of the screen.
PAGEUP
Displays the previous page of the screen.
FBUTTON
FBUTTON [button_name | ACTION (pql commands)]
[AT r,c]
[WIDTH w]
[PROMPT '']
The
FBUTTON command alters the visual appearance (position, width and prompt text) of a system button or defines a user button.Use one of the following button names to identify a system button:
FIRST|LAST|PREVIOUS|NEXT|EXIT|CLEAR|
STATUS|WRITE|RESET|DELETE|PAGEUP|PAGEDOWN|ACTION (pql commands)
Specifies a user button. Specify PQL commands to execute when pressed.
AT
Specifies the starting position (row and column) of the button.
PROMPT 'string'
Specifies the label on the button. If a user button is created and
PROMPT is not specified, the prompt is USER BUTTON plus a unique number.WIDTH
Specifies the width of the button.
GENERATE
GENERATE EXCLUDE | INCLUDE
SCREENS (screennames, ...)
VARS (variable, ...)
General Clauses:
[NO]DATA [AT r,c] [WIDTH n]
[NO]LABELS [AT r,c] [WIDTH n]
[NO]PROMPT [AT r,c] [WIDTH n] [VARDESC|VARLABEL|VARNAME]
ERROR number 'error text'
The GENERATE command in record or table screens uses the record or table schema to give the equivalent of default FIELD commands for every field. GENERATE in a menu screen produces the equivalent of a default CALL SCREEN to every previously defined record or table screen.EXCLUDE and INCLUDE clauses specify fields which are affected or not by the GENERATE and allow specific FIELD commands to be combined with a GENERATE command. When a FIELD command is specified for a variable, the variable should be EXCLUDED from the GENERATE otherwise it appears on the screen twice.GENERATE command apply to all fields generated by the command. The DATA, LABELS and PROMPT AT clause refers to the row position of the first field.EXCLUDE
Omits screens or variables from the
GENERATE. When EXCLUDE is specified, any variable not EXCLUDED is INCLUDED automatically (similarly any screen not EXCLUDED in a generated menu is INCLUDED).INCLUDE
Includes screens or variables in the
GENERATE. When INCLUDE is specified, any variables (or screens in menus) not INCLUDEd are EXCLUDEd.SCREENS
Specifies screen names to
INCLUDE or EXCLUDE in menu screens.VARS
Specifies a list of named variables.
EMPLOYEE record:
SCREEN RECORD EMPLOYEE / COMPANY.EMPLOYEE
TEXT 'This is the Demographic Record' AT +2
FIELD ID PROMPT 'Employee ID:'
FIELD NAME PROMPT 'Name of Employee'
FIELD SSN EDITOUT (COMPUTE FIELDOUT = EDIT (SSN,"^^^-^^-^^^^"))
EDITIN (COMPUTE SSN = REPLACE (FIELDIN,'-','',LEN(FIELDIN),1,0))
GENERATE EXCLUDE VARS (ID NAME SSN)
END SCREEN
Old Forms
There is an existing SirForms system which is a stand-alone system that uses a character style interface. While the PQLForms commands are different in design and operation, they can resemble old Forms. If comparing the new commands with old Forms note that:-
CALL SCREEN resembles the old Forms CALL; SCREEN RECORD resembles old Forms RECORD.
EDITOUT and EDITIN clauses on the FIELD command (instead of keywords such as DSPEDIT); the INITIAL, READ and WRITE clauses on the SCREEN command (instead of keywords such as ACCEPT).
LOOKUP command that approximates this command in old Forms.
FBUTTON ACTION to define a help button.
PQLForms Error Messages
Number Text
27 Record not found
30 Record Written
37 Case not found
38 No more records
47 Not a valid value
57 Failed Edit tests
110 Record failed write tests
118 Record was modified - OK to save ?



