Inserting and deleting rows in INPUT ARRAY

The INPUT ARRAY sub-dialog handles record list edition. This controller allows the user to directly edit existing rows and to create or remove rows with implicit actions.

Rows can be created with append or insert actions, and can be removed with the delete action. These three implicit actions are automatically created by the dialog:

To prevent INPUT ARRAY to create these implicit actions, set the APPEND ROW, INSERT ROW and/or DELETE ROW control attributes to FALSE. To fully deny row addition, set also the AUTO APPEND attribute to FALSE.
DIALOG ATTRIBUTES(UNBUFFERED)
  INPUT ARRAY p_items FROM sa.*
    ATTRIBUTES(AUTO APPEND=FALSE,
               INSERT ROW=FALSE)
     ...
  END INPUT
END DIALOG

Specific control blocks are available to take control when a row is created or deleted:

Dynamic arrays and the ui.Dialog class provide methods such as array.deleteElement() or ui.Dialog.appendRow() to modify the list. When using these methods, the predefined triggers such as BEFORE DELETE or BEFORE INSERT are not executed. While it is safe to use these methods within a DISPLAY ARRAY, you must take care when using an INPUT ARRAY. For example, you should not call such methods in triggers like BEFORE ROW, AFTER INSERT, BEFORE DELETE.

Users can append temporary rows by moving to the end of the list, or when executing the append action. Appending temporary rows is a different from doing an insert action; an appended row is considered temporary until the user modifies a field; an inserted row remains in the list even if the user did not modify a field.

By default, when the last row is removed by a delete action, the INPUT ARRAY instruction will automatically create a new temporary row at the same position. The visual effect of this behavior can be misinterpreted - if no data was entered in the last row, you can't see any difference. However, the last row is really deleted and a new row is created, and the BEFORE DELETE / AFTER DELETE / AFTER ROW / BEFORE ROW / BEFORE INSERT control block sequence is executed. In order to deny to avoid the creation of a new temporary row when the last row is deleted, set AUTO APPEND = FALSE attribute.

The insert, append or delete actions might be automatically disabled according to the context: If the INPUT ARRAY is using a static array that is full, or if the MAXCOUNT attribute is reached, both insert and append actions will be disabled. The delete action is automatically disabled when AUTO APPEND = FALSE and there are no more rows in the array.