Working with table buffers

On a successful table operation, a database trigger is activated and passes the contents of the table buffer for which the table operation occurred to the trigger processing procedure as an inout parameter. This buffer is always available to the trigger processing procedure, regardless of the table operation successfully completed.

For example, if a successful delete occurs for the RM_Customer_MSTR table, a delete trigger runs and passes the table buffer for the deleted record to the following processing procedure as an inout parameter. This trigger processing procedure then sets a key value for the corresponding third-party record and deletes it.

{Name: IG_Delete_Contact_History}
inout table RM_Customer_MSTR;

'Customer Number' of table IG_Contact_History_MSTR = 'Customer Number' of table RM_Customer_MSTR;
release table IG_Contact_History_MSTR;
change table IG_Contact_History_MSTR by number 1;
if err() = OKAY then
	remove table IG_Contact_History_MSTR;
	if isopen(form IG_Contact_History) then
		clear form IG_Contact_History;
	end if;
end if;

Retrieving the table operation

You can include a second optional integer in parameter in the trigger processing procedure. If this parameter is included, a value is automatically passed in indicating the table operation that activated the trigger. The value corresponds to the constants listed for the table_operations parameter for the Trigger_RegisterDatabase() function. If you specify several table operations for a trigger, this is useful in conditionally checking which table operation activated the trigger.

Using ranges

Successful table operations that occur for a range of records will activate a database trigger for each record in the range. The range operation passes each record’s buffer to the processing procedure.


Documentation Feedback