Was this helpful?
Row State and Record Values for Table Fields and Arrays
Each record in a table-field data set or array has an associated integer state value. You can reference the special constant _state to obtain this value for each record, or assign _state to a variable in an unloadtable statement. In addition, you can reference the special value _record to get the record's sequence number in the table field data set or array.
In a table field, _state indicates whether data in a data set record is Undefined, New, Unchanged, Changed, or Deleted. A record becomes Changed when the user types over it, or when its value is changed by a statement in the application.
By default, table-field _state and _record values are defined implicitly and maintained automatically by the Forms Runtime System (FRS). You can override the default value of Unchanged by assigning a value of Undefined, New, or Changed to _state when using insertrow to insert a row into a table field or a record into an array.
In an array, _state is primarily under programmer control. By default, _state is set to Unchanged when an array record is created and to Deleted when it is deleted. However, if a record is created through insertrow, you can specify a state of New or Changed, or Unchanged. This is useful primarily for applications in which you want to use an array that is based on a table field. You cannot set _state through an assignment statement.
In an array, _record is always set to the 1-relative position of the record in the array, and cannot be explicitly set. For deleted records, _record is negative or zero. Note that arrays do not have undefined rows.
You can set the _state of table fields and arrays using the insertrow and deleterow statements. These statements are discussed in Manipulating Table Fields and Arrays.
The following table provides default values of _state for a table field row and an array record.
State
Value
Description
Undefined
0
Empty table-field row appended but not filled by the application user.
New
1
Table-field row appended and filled by the user at run time.
Unchanged
2
Table-field row loaded or inserted by a 4GL statement, not changed by user. Row state after insertrow is (by default) 2.
Changed
3
Table-field row inserted by a 4GL statement but modified since by the user or by another 4GL statement.
Deleted
4
Table-field row inserted by a 4GL statement with state set to "Changed" or "Unchanged" but since deleted by another statement.
New
1
Record created by insertrow with _state = 1. Record has not been deleted.
Unchanged
2
Record created with _state unspecified or _state = 2. Record has not been deleted.
Changed
3
Record created by insertrow with _state = 3. Record has not been deleted.
Deleted
4
Array record marked for deletion by the deleterow statement or the arraysetrowdeleted procedure.
Last modified date: 01/30/2023