DeleteRow function
Syntax
DeleteRow(scrollpath, target_row)
Where scrollpath is:
[RECORD.level1_recname, level1_row, [RECORD.level2_recname, level2_row, ]] RECORD.target_recname
To prevent ambiguous references, you can also use SCROLL. scrollname, where scrollname is the same as the scroll level’s primary record name.
Description
Use the DeleteRow function to delete rows programmatically.
Note:
This function remains for backward compatibility only. Use the DeleteRow rowset class method instead.
See PeopleCode API Reference: DeleteRow method: Rowset class.
A call to this function causes the RowDelete event sequence to fire, as if an user had manually deleted a row.
DeleteRow cannot be executed from the same scroll level where the deletion will take place, or from a lower scroll level. Place the PeopleCode in a higher scroll level record.
When DeleteRow is used in a loop, you have to process rows from high to low to achieve the correct results, that is, you must delete from the bottom up rather than from the top down. This is necessary because the rows are renumbered after they are deleted (if you delete row one, row two becomes row one).
Parameters
| Parameter | Description |
|---|---|
|
scrollpath |
A construction that specifies a scroll level in the component buffer. |
|
target_row |
The row number of the row to delete. |
Returns
Boolean (optional). DeleteRow returns a Boolean value indicating whether the deletion was completed successfully.
Example
In the following example DeleteRow is used in a For loop. The example checks values in each row, then conditionally deletes the row. Note the syntax of the For loop, including the use of the -1 in the Step clause to loop from the highest to lowest values. This ensures that the renumbering of the rows will not affect the loop.
For &L1 = &X1 To 1 Step - 1
&SECTION = FetchValue(AE_STMT_TBL.AE_SECTION, &L1);
&STEP = FetchValue(AE_STMT_TBL.AE_STEP, &L1);
If None(&SECTION, &STEP) Then
DeleteRow(RECORD.AE_STMT_TBL, &L1);
End-If;
End-For;