21. 4GL Statement Glossary : ArrayRemoveRow()
 
Share this page                  
ArrayRemoveRow()
Removes a record from an array.
Syntax
returnfield = ] [callproc] arrayremoverow
    (arr, rownumber = integerexpr)
returnfield
Specifies the name of field to which the result is returned. Integer.
You must include a value for returnfield if you omit the callproc keyword; otherwise it is optional.
arr
Specifies the name of an array
integerexpr
Specifies an expression that indicates the record number of the record to be removed
Description
The arrayremoverow() built-in procedure permanently removes the specified record from an array. The record no longer exists in the array; as far as calls to arrayfirstrow() and arrayallrows() are concerned, the record never existed. You can use this to remove records marked deleted. The records following the removed one are renumbered.
The arrayremoverow() procedure returns 0 on success, or a non-zero number on failure (that is, the record you specified does not exist).
Example
To permanently remove the third record from the array emparray:
callproc arrayremoverow
  (emparray, rownumber = 3);
To permanently remove the first two records from the array emparray:
callproc arrayremoverow
  (emparray, rownumber = 1);
callproc arrayremoverow
  (emparray, rownumber = 1);
Rownumber is equal to 1 in both statements because, after removing the first record, the old second record becomes the first.