The entitySelection.length property returns the number of entities in the entity selection. If the entity selection is empty, it returns 0.
Entity selections always have a length property.
C_LONGINT(vSize)
vSize:=ds.Employee.query("gender = :1";"male").length
ALERT(String(vSize)+" male employees found.")