Usage / INPUT ARRAY control instructions |
Insertion can be canceled, by using the CANCEL INSERT instruction, in the BEFORE INSERT or AFTER INSERT blocks. Using this instruction in a different place will generate a compilation error.
The instructions that appear after CANCEL INSERT will be skipped.
A CANCEL INSERT executed inside a BEFORE INSERT block prevents the new row creation. These tasks are performed:
BEFORE INSERT IF user_can_insert() == FALSE THEN ERROR "You are not allowed to insert rows." CANCEL INSERT END IF
A CANCEL INSERT executed inside an AFTER INSERT block removes the newly created row. These tasks are performed:
AFTER INSERT WHENEVER ERROR CONTINUE INSERT INTO customer VALUES ( arr[arr_curr()].* ) WHENEVER ERROR STOP IF SQLCA.SQLCODE<>0 THEN ERROR SQLERRMESSAGE CANCEL INSERT END IF
If the CANCEL INSERT is done while on a new row that was appended to the end of the list, the new row will be removed and the previous row will get the focus. If there are no more existing rows, the list loses the focus because no row can be edited. The next time the user clicks in a cell, DIALOG will automatically create a new row.
CALL DIALOG.setActionActive("insert", FALSE) CALL DIALOG.setActionActive("append", FALSE)