| 4D v18entitySelection[index] | |||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
    4D v18
 entitySelection[index] 
         | ||||||||||||||||||||||||||||||||||||||||||||||
| Parameter | Type | Description | ||||||
| entitySelection[index] | Entity |   | Entity corresponding to the specified index (non assignable expression) | |||||
The entitySelection[index] notation allows you to access entities within the entity selection using the standard collection syntax: pass the position of the entity you want to get in the index parameter.
Note that the corresponding entity is reloaded from the datastore.
index can be any number between 0 and entitySelection.length-1.
Warning: entitySelection[index] is a non assignable expression, which means that it cannot be used as en editable entity reference with methods like entity.lock( ) or entity.save( ). To work with the corresponding entity, you need to assign the returned expression to an assignable expression, such as a variable. Examples:
 $sel:=ds.Employee.all() //create the entity selection
  //invalid statements:
 $result:=$sel[0].lock() //will NOT work
 $sel[0].lastName:="Smith" //will NOT work
 $result:=$sel[0].save() //will NOT work
  //valid code:
 $entity:=$sel[0]  //OK
 $entity.lastName:="Smith" //OK
 $entity.save() //OK C_OBJECT($employees;$employee)
 $employees:=ds.Employee.query("lastName = :1";"H@")
 $employee:=$employees[2]  // The 3rd entity of the $employees entity selection is reloaded from the database
	Product:  4D
	Theme:  ORDA - EntitySelection
	
        
        
	
	Created:  4D v17
	
	
	
	
	
	
	
	
	4D Language Reference ( 4D v18)
	
	
	
	
	
 Add a comment
Add a comment