Form specification files / Form file concepts |
Form fields defined with a table and column name get data type and attributes from the database schema file.
item-type item-tag = [table.]column [ , attribute-list ] ;
Unless a form field is defined with the FORMONLY prefix, its field description must specify the SQL identifier of a database table and column referenced in the database schema specified with the SCHEMA clause at the beginning of the form file. Additionally, the table name must be listed in the TABLES section of the form.
Fields are associated with database columns only during the compilation of the form specification file. During the compilation process, the form compiler examines the database schema file to identify the data type of the column, and two optional files, containing the definitions of data validation rules and item attributes. This technique allows to centralize form field definition in the schema files. You can for example define the DEFAULT attribute for a column.
After the form compiler extracts default attributes and identifies data types from the schema file, the association between fields and database columns is broken, and the form cannot distinguish the name or synonym of a table or view from the name of a screen record.The programs only have access to screen record fields , in order to display or input data using program variables. Regardless of how you define them, there is no implicit relationship between the values of program variables, form fields, and database columns. Even, for example, if you declare a variable lname LIKE customer.lname, the changes that you make to the variable do not imply any change in the column value. Functional relationships among these entities must be specified in the program code, through screen interaction statements, and through SQL statements. It is up to the programmer to determine what data a form displays and what to do with data values that the user enters into the fields of a form. You must indicate the binding explicitly in any statement that connects variables to forms or to database columns.
If a form field is declared with a table column using the SERIAL, SERIAL8 or BIGSERIAL SQL type, the field will automatically get the NOENTRY attribute, except if the field is defined with the TYPE LIKE syntax.
SCHEMA stores -- Database schema ... TABLES customer -- Database table END ATTRIBUTES EDIT f001 = customer.fname, -- Database column NOT NULL, REQUIRED, COMMENTS="Customer name" ; ...