The entitySelection.drop( ) method removes the entities belonging to the entity selection from the table related to its dataclass within the datastore. The entity selection remains in memory.
Note: Removing entities is permanent and cannot be undone. It is recommended to call this action in a transaction in order to have a rollback option.
If a locked entity is encountered during the execution of entitySelection.drop( ), it is not removed. By default, the method processes all entities of the entity selection and returns non-droppable entities in the entity selection. If you want the method to stop execution at the first encountered non-droppable entity, pass the dk stop dropping on first error constant in the mode parameter.
Example without the dk stop dropping on first error option:
C_OBJECT($employees;$notDropped)
$employees:=ds.Employee.query("firstName=:1";"S@")
$notDropped:=$employees.drop()
If($notDropped.length=0)
ALERT("You have dropped "+String($employees.length)+" employees")
Else
ALERT("Problem during drop, try later")
End if
Example with the dk stop dropping on first error option:
C_OBJECT($employees;$notDropped)
$employees:=ds.Employee.query("firstName=:1";"S@")
$notDropped:=$employees.drop(dk stop dropping on first error)
If($notDropped.length=0)
ALERT("You have dropped "+String($employees.length)+" employees")
Else
ALERT("Problem during drop, try later")
End if