Usage / INPUT ARRAY control blocks |
An ON ROW CHANGE block is executed when the user moves to another row, after modifications have been done in the current existing row.
This control block is typically used to detect row changes in a list, in order to update the corresponding database rows.
The code in ON ROW CHANGE will not be executed when leaving new rows created by the user with the default append or insert action. To detect row creation, you must use the BEFORE INSERT or AFTER INSERT control blocks.
The ON ROW CHANGE block is executed if the value of a field has changed since the row was entered and if the modification flag of the corresponding field is set. The field might not be the current field, and several field values can be changed. Changes can be done by the user, or by program: The modification flag is set on user input or by program, when doing a DISPLAY TO / DISPLAY BY NAME or when setting explicitly the flag with the ui.Dialog.setFieldTouched() method. The modification flag is reset for all fields when entering another row, or when leaving the dialog instruction.
INPUT ARRAY p_items WITHOUT DEFAULTS FROM s_items.* ... ON ROW CHANGE UPDATE items SET items.code = p_items[arr_curr()].code, items.description = p_items[arr_curr()].description, items.price = p_items[arr_curr()].price, items.updatedate = TODAY WHERE items.num = p_items[arr_curr()].num ...