deleterow Statement—Delete a Row
This statement deletes a row from the table field.
Syntax
deleterow formname tablename [row]]
Description
The deleterow statement deletes a row from the table field display and marks its state as DELETED. The remaining rows in the table field are compacted. The next row in the data set is immediately scrolled into the display.
Deleting a (changed or unchanged) row from a table field data set moves that row to the end of the data set. The values in deleted rows are still accessible to the program (using unloadtable), though the rows no longer appear in the table field display. However, when you delete rows having a state of new or undefined, those rows are removed from the data set, and are not accessible to the application program.
The FRS does not perform an automatic validation check before deleting the row.
The formname identifies the form in which the table field tablename is displayed. Use character string literals, quoted or unquoted, or program variables to represent either.
The row is the number of the displayed row to be deleted. It can be either an integer literal or an integer program variable. It must evaluate to a number not smaller than 1 nor greater than the total number of displayed rows in the table field. If you do not include row, the row on which the cursor is currently resting is deleted.
Examples—deleterow statement:
Example 1:
The Delete menu item deletes the current row and saves the employee number, for use in updating the database (unless the row was a NEW row, appended by the runtime user, in which case the row is not used to update the database).
exec frs activate menuitem 'Delete';
exec frs begin;
exec frs getrow (:eno = eno, :state = _state);
exec frs deleterow empform employee;
if (state = 2 or state = 3) then
/*
** The state indicates that the row was loaded
** by program from the database. (It may have
** since been modified.)
*/
exec sql delete from employee
where eno = :eno;
end if;
exec frs end;
Example 2:
Get null values.
exec frs getrow (:spouse_var:indicator_var = spouse,
:age_var = age)
exec frs deleterow empform employee 1