The Customer List Form

The Customer List form displays when the user clicks the button next to the store number field (the buttonEdit widget). The custlist.per form defines a typical 'zoom' form with a filter field and record list where the user can pick an element to be used in a field of the main form. Using this form, the user can scroll through the list to pick a store, or can enter query criteria to filter the list prior to picking. The fields that make up the columns of the table that display the list are defined as FORMONLY fields. When TYPE is not defined, the default data type for FORMONLY fields is CHAR.

Form custlist.per:

001 SCHEMA custdemo 
002 
003 LAYOUT
004 GRID
005 {
006 <g g1                                        >
007  Store name: [fc                     :fe   ]
008 <                                            >
009 <t t1                                        >
010   Id   Name                  City
011  [f01 |f02                  |f03            ]
012  [f01 |f02                  |f03            ]
013  [f01 |f02                  |f03            ]
014  [f01 |f02                  |f03            ]
015 <                                            >
016 }
017 END
018 END
019 
020 TABLES
021    customer 
022 END
023 
024 ATTRIBUTES
025 GROUP g1: TEXT="Filter";
026 EDIT fc = customer.store_name;
027 BUTTON fe: fetch, IMAGE="filter";
028 EDIT f01=FORMONLY.s_num;
029 EDIT f02=FORMONLY.s_name;
030 EDIT f03=FORMONLY.s_city;
031 END
032 
033 INSTRUCTIONS
034 SCREEN RECORD sa_cust (FORMONLY.*);
035 END
Note:
  • Line 001 defines the database schema to be used by this form.
  • Lines 003 thru 018 define a LAYOUT section that describes the layout of the form.
    • Lines 006 thru 008 define a GROUPBOX with the fc field where the user can enter a search criteria, and the fe button to trigger the query.
    • Lines 009 thru 015 define a TABLE that will be used to display the result set of the query.
  • Lines 020 thru 022 define a TABLES section to reference database schema tables.
  • Lines 024 thru 031 define an ATTRIBUTES section with the details of form fields.
    • Line 026 defines the query field with a reference to the customer.store_name database column. This will implicitly define the data type of the field and the Query by Example input rules.
    • Line 027 defines the BUTTON that will invoke the database query.
    • Lines 028 thru 030 define the columns of the table with the FORMONLY prefix.
  • Lines 033 thru 035 define an INSTRUCTIONS section to group item fields in a screen array.