Table Field Row States
A table field displays a specified number of rows from its underlying data set. As with simple fields, you can edit the data displayed in table field rows. In addition, you can insert rows into the display and leave them blank or fill them with data. You can also delete a displayed row. The _state constant enables you to determine the status of a table field row.
The _state constant returns an integer value that corresponds to the row's state. In a conditional statement, placed within an unloadtable or getrow statement, its value can determine the disposition of the data in the row.
The following example of an unloadtable statement illustrates a typical use of _state:
exec frs unloadtable empform employee
(:var1 = column1, :var2 = column2,
:statevar = _state);
exec frs begin;
/*
** Depending on the value of 'statevar,' perform an
** INSERT, DELETE or UPDATE to a database table,
** using the values unloaded from 'column1'
** and 'column2.'
*/
exec frs end;
Because it is intended to keep track of changes made by the runtime user, the _state constant only records changes made to the displayed columns of a table field, either visible or invisible. The _state constant does not record changes to hidden columns, because hidden columns are under the control of the application and are not affected by the runtime user. You can, however, record changes to hidden columns by initializing a special hidden column in the table field and changing its value when changes are made to other hidden columns by the program.
The _state constant can return the following values: