Row-level events

Row-level events are defined for making local changes to the records in a ProDataSet member buffer object. The following table lists the row-level events.

Row-level events
Event Affected objects AVM action
ROW-CREATE Buffer object of a DATASET temp-table This event occurs immediately after the record is created in the temp-table. The current buffer for the temp-table is available and contains initial values as defined in the temp-table definition (or inherited from the schema). You can use this event to calculate initial values for fields, make changes to other records, or reject the creation by deleting the new temp-table record.
ROW-DELETE Buffer object of a DATASET temp-table This event occurs when you delete a temp-table record, immediately before the record is deleted. The event procedure can use this event to RETURN ERROR to cancel the delete, or to make adjustments to other records based on the delete. Since the record has not yet been deleted, the record is in the temp-table buffer and the code can look at its values. Because the code can assume that the DELETE will go through unless cancelled by the event procedure itself, it can take actions based on the record deletion while the record is still there to be looked at.
ROW-UPDATE Buffer object of a DATASET temp-table This event occurs immediately before the record is updated in the temp-table. It typically occurs when:
  • The buffer scope ends
  • The transaction scope ends
  • The RELEASE statement or BUFFER-RELEASE( ) method is run on the buffer
  • The buffer is needed for another record
The AVM sets the SELF system handle to the handle of the buffer on which the event procedure is running before calling the event handler. If the event handler returns NO-APPLY or ERROR, the return is ignored. The handler has run, and it is too late to undo any changes to the record.

You can use this event to determine if and how a record has changed by reading the buffer in the before-image table (using the SELF:BEFORE-ROWID attribute) and comparing it to the updated buffer. You can also use this event in the event handler to update fields in the record (for example, to supply a calculated field).

You cannot read another record into the buffer on which the event procedure is running in the event handler. If you need to read another record, use a different buffer to avoid disturbing the record you are currently updating.