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
}
- table is the name or alias of a table, synonym, or view, as declared in the
TABLES
section. - column is the name of a database column.
- field-name is the identifier that will be used in programs to handle the field.
- interval-qualifier is an
INTERVAL
qualification clause such asHOUR(5) TO SECOND
. - datetime-qualifier is a
DATETIME
qualification clause such asDAY 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.
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.
TYPE datatype
clause, you explicitly
specify the type of the field. 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;