Tutorial Chapter 7: Array Display |
The scrolling list of customer records demonstrated in this chapter requires a form specification file containing a screen array of screen records.
In a text-based form specification file (.per), a screen array is usually a repetitive array of fields in the LAYOUT section, each containing identical groups of screen fields.
Each "row" of a screen array is a screen record. Each "column" of a screen array consists of fields with the same item tag in the LAYOUT section of the form specification file. You must declare screen arrays in the INSTRUCTIONS section.
The TABLE container in a form defines the presentation of a list of records, bound to a screen array.
When this layout container is used with curly braces defining the container area, the position of the static labels and item tags is automatically detected by the form compiler to build a graphical object displaying a list of records.
The first line of the TABLE area contains text entries defining the column titles. The second line contains field item tags that define the columns of the table receiving the data. This line is repeated to allow the display of multiple records at once.
The user can sort the rows displayed in the form table by a mouse-click on the title of the column that is to be used for the sort. This sort is performed on the client side only. The columns and the entire form can be stretched and re-sized. A right-mouse-click on a column title displays a dropdown list-box of column names, with radio buttons allowing the user to indicate whether a specific column is to be hidden or shown.
You must declare a screen array in the INSTRUCTIONS section of a text-based form specification file (.per) with the SCREEN RECORD keyword. You can reference the names of the screen array in the DISPLAY ARRAY statement of the program.
The manycust.per form specification file contains a TABLE Container and screen array used to display a list of customer rows
01 SCHEMA custdemo 02 03 LAYOUT 04 TABLE 05 { 06 Id Name ... zip_code Contact Phone 07 [f01][f02 ] [f05 ][f06 ][f07 ] 08 [f01][f02 ] [f05 ][f06 ][f07 ] 09 [f01][f02 ] [f05 ][f06 ][f07 ] 10 [f01][f02 ] [f05 ][f06 ][f07 ] 11 [f01][f02 ] [f05 ][f06 ][f07 ] 12 [f01][f02 ] [f05 ][f06 ][f07 ] 13 } 14 END 15 END 16 17 TABLES 18 customer 19 END 20 21 ATTRIBUTES 22 EDIT f01=customer.store_num; 23 EDIT f02=customer.store_name; 24 EDIT f03=customer.city; 25 EDIT f04=customer.state; 26 EDIT f05=customer.zip_code; 27 EDIT f06=customer.contact_name; 28 EDIT f07=customer.phone; 29 END 30 31 INSTRUCTIONS 32 SCREEN RECORD sa_cust (customer.*); 33 END
In order to fit on the page, the layout section of the form is truncated, not displaying the city and state columns.