Formonly fields

FORMONLY form fields define their data type explicitly, with or without referencing a database columns.

Syntax 1: In grid-based container

item-type item-tag = FORMONLY.field-name
   [ TYPE
      { LIKE [table.]column
      | datatype [NOT NULL] }
   ]
     [ , attribute-list ]  ;

Syntax 2: In stack-based container

item-type FORMONLY.field-name
   [ TYPE
      { LIKE [table.]column
      | datatype [NOT NULL] }
   ]
     [ , attribute-list ]  ;

where datatype is one of:

{ CHAR
| DECIMAL [(p[,s])]
| SMALLFLOAT
| REAL
| FLOAT
| MONEY [(p[,s])]
| INTEGER
| SMALLINT
| DATE
| VARCHAR
| TEXT
| BYTE
| INTERVAL interval-qualifier
| DATETIME datetime-qualifier
| BIGINT
| BOOLEAN
}
  1. table is the name or alias of a table, synonym, or view, as declared in the TABLES section.
  2. column is the name of a database column.
  3. field-name is the identifier that will be used in programs to handle the field.
  4. interval-qualifier is an INTERVAL qualification clause such as HOUR(5) TO SECOND.
  5. datetime-qualifier is a DATETIME qualification clause such as DAY TO SECOND.

Usage

Form fields can be specified with the FORMONLY prefix, when there is no corresponding database column, or when the field must be defined with another name to that of the database column.

Important: The data type of a form field is only used by the CONSTRUCT interactive statement to do database queries. When using the form field with an INPUT, INPUT ARRAY or DISPLAY ARRAY dialog, the type of the program variable defines the data type of the form field.

When using the LIKE [table.]column syntax, the form field gets the data type of the specific table column as defined in the database schema. The table name must be specified in the TABLES section.

When using the TYPE datatype clause, you explicitly specify the type of the field.
Note: For CHAR/VARCHAR data types, the size is defined by the item tag length in the layout.

If no data type is specified, and no database column is referenced, the default data type is CHAR.

Specifying a data type followed by the NOT NULL keyword is equivalent to the NOT NULL attribute.

The STRING data type is not supported in FORMONLY form field definitions.

The definition of FORMONLY fields can be completed by using the DISPLAY LIKE and VALIDATE LIKE attributes, to get the display and validation attributes from the .att and .val database schema files.

Example

Grid-based container FORMONLY form field definition (in the ATTRIBUTES section):

LAYOUT
GRID
{
 [f001             ]
 [f002             ]
 ...
}
END
END
ATTRIBUTES
EDIT f001 = FORMONLY.total TYPE DECIMAL(10,2), NOENTRY ;
EDIT f002 = FORMONLY.name TYPE LIKE customer.cust_name,
            VALIDATE LIKE customer.cust_name ;

Stack-based container FORMONLY form field definition:

LAYOUT
  STACK
  GROUP
    EDIT FORMONLY.total TYPE DECIMAL(10,2), NOENTRY ;
    EDIT FORMONLY.name TYPE LIKE customer.cust_name, REQUIRED;