Event aread

Description

This event is used when a read operation has been triggered in a CRUD operation of a working copy (when the $edit facet is requested) either on the main class or on a child class. It allows development partners to write their own code for implementing the database read. This event is called in two cases:

  • For a persistent class, if the Read check box is not selected in the Mapping tab. This means that the code associated with the read operation of the data 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 read 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 reads an instance of the class in the database for a working copy. When the entity managed has a child structure, it can be either on an instance of the main class or on 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.

Context

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 AREAD.
  • The key values are local variables that have the name of the key segments as they are defined in the main table associated to the class.

Example:

Let's take the example of a BOM table that has a main key with 3 components (ITMREF, BOMALT, BOMALTTYP).
If we imagine (it will probably not be the case) that the developers wants to handle the AREAD method by himlelf, the 3 parameters ITMREF, BOMALT, and BOMALTTYP would be sent with their name, and this mean that the method implementation would execute lines such as:

$AREAD_METHOD
  Local File BOM [BOH]
  Read [BOH]BOH0=[L]ITMREF;[L]BOMALT;[L]BOMALTTYP
  ...