The entitySelection.last( ) method returns a reference to the entity in the last position of the entity selection.
The result of this method is similar to:
$entity:=$entitySel[length-1]
If the entity selection is empty, the method returns Null.
C_OBJECT($entitySelection;$entity)
$entitySelection:=ds.Emp.query("salary < :1";50000)
If($entitySelection.length#0)
$entity:=$entitySelection.last()
End if