|
|
HP Data Entry and Forms Management System (VPLUS) Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 4 Advanced Forms DesignStatement Syntax |
|
The processing specifications consist of statement names followed by parameters. The description of each statement uses the conventions defined at the beginning of the manual. In order to understand the notation used in the statement formats in this section, you should review these conventions. Multiple statements can be placed on the same line by following the last parameter of the statement by a blank and the next statement. If you want, you can separate statements on the same line with an optional semicolon (;). For example:
Statements may begin anywhere on the line, except for nested IF statements where indentation is significant. Multiple blanks are ignored within a line, except at the beginning of a line in a nested IF statement. Comments may be included in the text by preceding the comment
with a backslash (\). Anything typed between the backslash
and the end of the line is ignored. For example: Statements that are not completed before the first backslash or the end of the line can be continued anywhere on the next line. A continuation character, the ampersand (&), is used only when a string literal must be continued on the next line. The ampersand concatenates two or more string literals to form one string. For example:
Whenever a field edit statement detects an error at run-time, the application can call the appropriate VPLUS intrinsics to have an error message (provided by VPLUS) issued and displayed in the window line, such as is done with ENTRY. You may choose to write a custom message to be issued when a field fails a particular edit specification. To do this, you specify the custom message in quotes immediately following the statement to which it applies. Figure 4-1 “Field Menu with Processing Specifications” illustrates a Field Menu in which the processing specifications contain custom error messages. When and if the statement causes a field to fail, the custom message is displayed instead of a VPLUS error message. For example:
The field attributes for the field determine the first checks made on the data in the field. For example, if the field is required (FType=R), it is checked to be sure that the user has entered a value in the field. Editing is performed according to the data type. For example, if the data type is DIG, then the field is checked to be sure that only the digits 0-9 were entered in the field. Next, the processing specifications are tested in the order they are specified. As an example, consider the specifications in Figure 4-2 “Field Menu with Custom Error Messages” After making the checks based on the field attributes, data entered in the field is tested to be sure that at least 5 digits were entered (MATCH ddddd), and optionally the value is checked for a hyphen and 4 more digits ([ - dddd ]). In all cases, the checks are performed by VPLUS when the application calls the appropriate VPLUS intrinsics, as described in Section 6. The following sections provide a summary of all the statements that may be entered in the Processing Specifications area of the Field Menu. Each of these statements is fully described later in this section.
Whenever value is specified as an operand in a field processing statement, a field name, constant, expression, or a save field name can be used. If the operand is numeric, any of these can be combined into an arithmetic expression whose result is used as the operand. Another operand, index, is used to retrieve items from a list by an index value. It must be enclosed within parentheses in edit statements; in SET and CHANGE statements, it can be specified without the enclosing parentheses. The name of any existing field within the same form can be specified as a value operand. When a field name is specified, the value in that field at run-time is used to check the current field. A field name in an editing statement must describe a field of the same data type (character, numeric, or date) as the current field. Constants are divided into categories corresponding to the three main data types: character, numeric and date. In addition, there are four system defined constants:
Character constants are strings of any character enclosed in single or double quotes. For example: "This is a constant." Numeric constants are digit strings with an optional leading sign and optional decimal point. Commas are not allowed in numeric constants. If the constant has no decimal point, a decimal is assumed at the right of the rightmost (least significant) digit. $EMPTY (all blanks) can be used to indicate a numeric constant less than any non-$EMPTY value, $LENGTH can be used to indicate the length of the current field. The following examples Illustrate numeric constants: .23 A date constant can be any legal date format, but it must be in the order MDY. With Native Language Support, the date constant order (e.g., mmddyy) will not be language dependent. For more information on Native Language Support, see Section 8. To distinguish it from other constants, a date constant must be delimited by exclamation points (!). Note that the date constant in the order MDY is used to check date values in any of the three legal orders: MDY, DMY, or YMD. A special date constant $TODAY is equivalent to the date at execution time. Examples of date constants are:
Any numeric constant, field, or save field can be combined into an arithmetic expression. The expression is evaluated to generate a constant that can be used to check a field or replace the value of a field. The operators used to form an arithmetic expression are:
The operators determine the order of evaluation in the standard operator hierarchy where + and - are evaluated after *, /, and %. Operators at the same level are evaluated from left to right. Parentheses may be used to further define the hierarchy. Expressions within parentheses are evaluated first and, if parentheses are nested, the innermost are evaluated first. The % in the expression a%b is equivalent to (a*.01)*b. When $EMPTY is used in an arithmetic expression, the result is always $EMPTY. Thus, $EMPTY with any operator and operand = $EMPTY. The following examples illustrate arithmetic expressions:
An index retrieve operand (enclosed within parentheses) can be used in any edit statement where a constant, field, or expression is legal. An index retrieve operand without enclosing parentheses can be used in SET and CHANGE statements. An index retrieve operand is specified in the format:
When an operand of this type is specified, its effective value is selected from a list of values according to its position in the list, where the first element of the list is 1. First, the index expression is evaluated, then this value is used to select a final value from the list. For example:
If an index has a value beyond the number of elements in the list or is $EMPTY, an error is returned. |
|