Database data events
Reference topic for the database data code events set.
Event | Use when ... | Function |
---|---|---|
Set Default Values |
Use this event if you need to change a default value, or if you want to set a default value for a field that does not have a default value defined in the database schema. This event is called to initialize business records with default values from the database schema. For a Form, it is called when a new row is created. For a CRUD Web Service, it is called before initializing a field in the business record. |
SetDefaultValues |
Check Table Constraints | The BAM generates code to check constraints defined in the database table:
Use this event if you are using a database for which constraints are missing, and where you cannot update the database schema. To preserve data integrity, you can implement constraints and referential integrity checks as if the schema was designed with them. For example, use this event to ensure that a field does not have aNULL value. This event is called to check table constraints before inserting or updating rows. |
CheckTableConstraints |
Before Insert Row By Key |
Use this event if you are using a database for which constraints are missing, and where you cannot update the database schema. To preserve data integrity, you can implement constraints and referential integrity checks as if the schema was designed with them. For example, you can check to ensure that the field value entered as a foreign key does exist in the related table. |
BeforeInsertRowByKey |
After Insert Row By Key |
Use this event for administration tasks that might otherwise be performed in SQL triggers. For example, when a record for a new employee is created, the salaries table might be updated. It is recommended to avoid duplicating a SQL trigger in the database. If a database trigger exists, there is no need to create the event. |
AfterInsertRowByKey |
Before Update Row By Key |
Use this event if you are using a database for which constraints are missing, and where you cannot update the database schema. To preserve data integrity, you can implement constraints and referential integrity checks as if the schema was designed with them. For example, you can check to ensure that the field value entered as a foreign key does exist in the related table. |
BeforeUpdatetRowByKey |
After Update Row By Key |
Use this event for administration tasks that might otherwise be performed in SQL triggers. For example, when a record is updated in the orders table, the stock inventory table is also updated. It is recommended to avoid duplicating a SQL trigger in the database. If a database trigger exists, there is no need to create the event. |
AfterUpdateRowByKey |
Before Delete Row By Key |
Use this event to execute code prior to deleting a row. For example, you can use this event to write the row of data to a backup table before the row is deleted. |
BeforeDeleteRowByKey |
After Delete Row By Key |
Use this event for administration tasks that might otherwise be performed in SQL triggers. For example, you can check if the SQL operation to delete the row was successful and revert any changes made to tables in the Before Delete Row By Key event if not. It is recommended to avoid duplicating a SQL trigger in the database. If a database trigger exists, there is no need to create the event. |
AfterDeleteRowByKey |