Usage / INPUT ARRAY control blocks |
The BEFORE DELETE block is executed each time the user deletes a row, before the row is removed from the list.
You typically code the database table synchronization in the BEFORE DELETE block, by executing a DELETE SQL statement using the primary key of the current row. In the BEFORE DELETE block, the row to be deleted still exists in the program array, so you can access its data to identify what record needs to be removed.
If needed, the deletion can be canceled with the CANCEL DELETE instruction.
When called in this block, the ARR_CURR() function returns the index of the row that will be deleted.
INPUT ARRAY p_items WITHOUT DEFAULTS FROM s_items.* ... BEFORE DELETE WHENEVER ERROR CONTINUE DELETE FROM items WHERE item_num = p_items[arr_curr()].item_num WHENEVER ERROR STOP IF SQLCA.SQLCODE<>0 VALUES ERROR SQLERRMESSAGE CANCEL DELETE END IF ...