This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
entity.indexOf( )
|
entity.indexOf ( {entitySelection} ) -> Result | ||||||||
Parameter | Type | Description | ||||||
entitySelection | EntitySelection |
![]() |
Position of the entity is given according to this entity selection | |||||
Result | Longint |
![]() |
Position of the entity in an entity selection | |||||
The entity.indexOf( ) method returns the position of the entity in an entity selection.
By default if the entitySelection parameter is omitted, the method returns the entity's position within its own entity selection. Otherwise, it returns the position of the entity within the specified entitySelection.
The resulting value is included between 0 and the length of the entity selection -1.
C_OBJECT($employees;$employee)
$employees:=ds.Employee.query("lastName = :1";"H@") //This entity selection contains 3 entities
$employee:=$employees[1] //This entity belongs to an entity selection
ALERT("The index of the entity in its own entity selection is "+String($employee.indexOf())) //1
C_OBJECT($employee)
$employee:=ds.Employee.get(725) //This entity does not belong to an entity selection
ALERT("The index of the entity is "+String($employee.indexOf())) // -1
Product: 4D
Theme: ORDA - Entity
Created: 4D v17
4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)