ui.Dialog.deleteRow

Deletes a row from the specified list.

Syntax

deleteRow(
   name STRING,
   index INTEGER )
  1. name is the screen array name.
  2. index is the index of the row to be deleted (starts a 1).

Usage

The deleteRow() method deletes the specified row. This method does not reset the current row or raise any BEFORE DELETE / AFTER DELETE / AFTER ROW / BEFORE ROW control blocks (except in some particular situations, outlined in other topics as necessary). It is quite similar to deleting an element to the program array, except that internal registers are automatically updated (like the total number of rows returned by getArrayLength()). If the list was decorated with cell attributes, the program array defining the attributes will also be synchronized. If multi-row selection is enabled, selection information is synchronized (i.e. selection flags are shifted up) for all rows after the deleted row.

This method must not be called in control blocks such as BEFORE ROW, AFTER ROW, BEFORE INSERT, AFTER INSERT, BEFORE DELETE, AFTER DELETE, it is designed to be used in an ON ACTION block.

After the method is called, the row no longer exists in the program array, and the getArrayLength() method will return the new row count.

If the deleteRow() method is called during an INPUT ARRAY, and after the call no more rows are in the list, the dialog will automatically append a new temporary row if the focus is in the list, to let the user enter new data. When using AUTO APPEND = FALSE attribute, no temporary row will be created and the current row register will be automatically changed to make sure that it will not be greater than the total number of rows.

If deleteRow() method is called during an INPUT ARRAY or DISPLAY ARRAY that has the focus, control blocks such as BEFORE ROW / BEFORE FIELD will be executed if you delete the current row. This is required to reset the internal state of the dialog.

If you pass zero as row index, the method does nothing (if no rows are in the list, getCurrentRow() returns zero).

The following code example implements a user-defined action to remove the rows that have a specific property:
ON ACTION delete_invalid_rows 
  FOR r = 1 TO DIALOG.getArrayLength("sa")
    IF NOT s_orders[t].is_valid THEN
      CALL DIALOG.deleteRow("sa",r)
      LET r = r - 1
    END IF
  END FOR