Deleterow
Deletes a row from a table field on the current form or a record from an array.
Syntax
deleterow tablefieldname [ [integerexpr] ]
deleterow arrayname [integerexpr]
tablefieldname
Specifies the name of the table field from which you are deleting a row. This is a 4GL name (unless you include integerexpr and its enclosing brackets).
arrayname
Specifies the name of the array from which you are deleting a record.
integerexpr
Specifies an integer expression indicating the number of the row to be deleted.
For a table field, the integer expression refers to a row in the table-field display rather than to a row in the data set. For an array, the integer expression refers to a record in an array.
As is usual for a 4GL name, tablefieldname derives its value from a field, a table-field column, or other variable not containing a row reference. If tablefieldname is derived from a table-field column, the value must be in the row on which the cursor is currently resting, not in a row location specified with a row number.
Description
The 4GL deleterow statement deletes a table-field row or array record.
For table fields, deleterow deletes the row on which the cursor is currently resting, unless you add an integer (integerexpr). In this case, it deletes the row with that number. For table fields, deleterow is not successful unless the cursor is on the table field or an integer expression is specified. For arrays, an integer expression must be specified.
The deleterow statement removes the specified table field row from the display. If the specified row had a state of Undefined or New, then deleterow also removes it from the table field dataset. If the specified row had a state of Unchanged or Changed, deleterow leaves it in the table field dataset, but changes its state to Deleted.
Deleterow does not validate the table field row before deleting it. To do this, precede the deleterow statement with a validrow statement.
For arrays, deleterow moves the array record to the beginning of the array, sets its state to Deleted, and changes its index to 0 (for the first deleted row) or the next highest negative integer. You can reference such records in either of the following ways:
• Explicitly by means of their new non-positive index
• Implicitly with the unloadtable statement
Examples
Delete the current row in the table field:
deleterow partstbl;
Delete the third row in the table field:
deleterow partstbl[3];
Delete the seventh record of an array:
deleterow emparray[7];