La propiedad entitySelection.length devuelve el número de entidades en la entity selection. Si la entity selection está vacía, devuelve 0.
Las entity selections siempre tienen una propiedad length.
C_LONGINT(vSize)
vSize:=ds.Employee.query("gender = :1";"male").length
ALERT(String(vSize)+" male employees found.")