Event aupdate

This event is called to allow development partners to write their own code for implementing the database update. This event is called in two cases:
* For a persistent class, if the Update check box is not selected in the Mapping tab. This means that the code associated with the update in the database is not managed by the supervisor. The development partners must write their own code in this event. If the check box is selected, the supervisor calls a generated code to perform the update and the event is not called.
* For an interface class in all the cases.

If the conditions above are fulfilled, the event is called when a CRUD operation modifies an instance of the class in the database for a working copy. When an update is done on the main instance, it can be either on an instance of a main class or an instance of a child class.

If an error occurs during this update, the development partner can use the ASETERROR(PRO,MES,NUM) method on the current class. A Rollback will automatically be triggered and the corresponding AINSERT_ROLLBACK event will be called.

Context

The class is filled, all the controls have been performed, and the table declared in the class logic is opened. A transaction is in progress. The development partner can update the data in the database for the concerned class.

The following variables or properties are available in the context:

  • this refers to the current class. All properties can be found using the this.PROPERTY syntax.
  • CURPTH describes the child class path if the method is called on a child class. If the method is called on the main class, CURPTH is empty.
  • AEVENT is equal to AUPDATE.
  • this.snapshot refers to the instance storing the values of the current class before the update.