Example: Form Specification File custform.per

This form specification file is used with the dispcust.4gl program to display program variables to the user. This form uses a layout with a simple GRID to define the display area.

File custform.per:
01 SCHEMA custdemo 
02
03 LAYOUT
04   GRID
05   {
06    Store #:[f01  ] Name:[f02                 ]
07    Address:[f03                 ]
08            [f04                 ]
09       City:[f05             ]State:[f6]Zip:[f07   ] 
10    Contact:[f08                           ]
11      Phone:[f09                ]       
12
13   }   
14   END   --grid 
15 END  -- layout 
16
17 TABLES 
18     customer 
19 END
20
21 ATTRIBUTES
22 EDIT f01 = customer.store_num, REQUIRED;
23 EDIT f02 = customer.store_name, COMMENT="Customer name";
24 EDIT f03 = customer.addr;
25 EDIT f04 = customer.addr2;
26 EDIT f05 = customer.city;
27 EDIT f6  = customer.state;
28 EDIT f07 = customer.zip_code;
29 EDIT f08 = customer.contact_name;
30 EDIT f09 = customer.phone;
31 END
Note:
  • Line 01 lists the database schema file from which the form field data types will be obtained.
  • Lines 03 through 15 delimit the LAYOUT section of the form.
  • Lines 04 thru 14 delimit the GRID area, indicating what will be displayed to the user between the curly brackets on lines 05 and 13.
  • Line 17 The TABLES statement is required since the field descriptions reference the columns of the database table customer.
  • Within the grid area, the form fields have item tags linking them to descriptions in the ATTRIBUTES section, in lines 20 thru 28. As an example, f01 is the display area for a program variable having the same data type definition as the store_num column in the customer table of the custdemo database.
  • Line 22 All of the item-tags in the form layout section are listed in the ATTRIBUTES section. For example, the item-tag f01 is listed as having an item-type of EDIT. This field will be used for display only in this program, but the same form will be used for input in a later program. An additional attribute, REQUIRED, indicates that when this form is used for input, an entry in the field f01 must be made. This prevents the user from trying to add a row with a NULL store_num to the customer table, which would result in an error message from the database.
  • Line 23 The second field is defined with the attribute COMMENT, which specifies text to be displayed when this field gets the focus, or as a tooltip when the mouse goes over the field.