16. Table Fields : Table Field Operations : How Table Field Modes Can Be Set Dynamically
 
Share this page                  
How Table Field Modes Can Be Set Dynamically
To change the mode of a table field dynamically use the set_frs statement. The data set associated with the table field is retained unless the change is to or from the query mode. When the mode changes to or from the query mode, the data set is lost, as if the program had executed a clear field on the table field. In addition, changing a table field's mode can cause any derived fields dependent on the table field's columns to be marked invalid and recalculated. (For information about derived fields and their behavior, see Derived Fields.)
The following table summarizes the behavior of the FRS when a table field mode is changed dynamically:
Starting Mode
New Mode
 
 
 
Fill
Update
Read
Query
Fill
Changes mode only; no other action
Validates table field
Clears data set
Update
Adds row
Validates table field
Clears data set
Read
Adds row
Changes mode only; no other action
Clears data set
Query
Clears data set
Clears data set
Clears data set
Clears data set
The short entries in the table indicate the following behavior:
Starting Mode
New Mode
Adds row
If the table field had no rows, changing to fill mode adds one row to the data set.
Clears data set
Clears the data set, including hidden fields, and moves the cursor to the first row and column of the table field. Performs any entry activations defined for that column if the cursor was not on that field before the mode change.
Validates table field
Validates the visible rows of the table field before changing the mode. If the validation fails, the mode is not changed.
The program can use the inquire_frs statement to determine the current mode of a table field if it is unknown.
For a complete discussion of the syntax of these statements, see the set_frs and inquire_frs statement descriptions in Forms Statements.