Event adelline_before
This event is called when a DELETE operation is requested on a (1,N) or (0,N) collection.
In this context, the deletion is not yet done, and the event can reject the DELETE operation by returning in ASTATUS
an error status ([V]CST_AERROR
).
The following variables or properties are available in the context:
this
refers to the current class. All properties can be found by using the this.PROPERTY
syntax.CURPRO
is empty.AEVENT
is equal to ADELLINE_BEFORE.CURPTH
contains the collection code.ALINE
contains the line position where the deletion must be done.The different values possible for ALINE
are:
[V]CST_AFIRSTPOS
if a line must be deleted at the first position of the collection.Take care that if you want to control the line that will be deleted, you have to use the AGETINDBYLINE method to get the physical position. This can be done by the following code:
$ADELLINE_BEFORELocal Integer LCONTROL, POSCONTROLIf ALINE<>[V]CST_ALASTPOSIf ALINE=[V]CST_AFIRST_POSLCONTROL=1ElseLCONTROL=ALINEEndifPOSCONTROL=fmet this.AGETINDBYLINE("COLLECT",LCONTROL)If POSCONTROL>0# Here you can control the properties of this.COLLECT(POSCONTROL) to decide if the insertion can be doneElse# The position sent is not valid, raise an error or ignoreEndifElse# This case is not possible because this position refers to a position for a line additionEndif