Event aupdate_control_before

This event is called before the update of a line in the database and works similar to the AINSERT_CONTROL_BEFORE event. It assigns values on properties because no control has been done on the properties. The development partner has access to the this.snapshot reference to access the origin value of the property being controlled.

After this event is called, three controls will be done on every property of the class:

  • The first control verifies if mandatory properties have been filled.
  • The second control verifies if the expected format is respected, for example, the number of characters or digits, or the consistency of dates.
  • The third control performs the other controls associated with the data types. This will trigger the CONTROL event on every property.

When nested classes must be controlled, such as a 3-level header / line / sub-line structure exists, the event is performed on the header level first, then on the first line and its associated sub-lines, on the second line and its associated sub-lines, and so on.

When complex updates are done on nested classes, this event is called only if a line has been modified.

  • If a new line is inserted, the insertion events are called on the line.
  • If a line is deleted, the deletion events are called on the line.
  • If a line is not modified at all, no event is called on the line.

If all the controls related to the update are not fulfilled, an error can be triggered.

Context

The following variables or properties are available in the context:

  • this refers to the current class. All the properties can be found using the this.PROPERTY syntax.
  • this.snapshot refers to the initial values for the current class. It allows a development partner to know if a modification was done on some properties.
  • 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_CONTROL_BEFORE.