This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
entitySelection.add( )
|
entitySelection.add ( entity ) -> Result | ||||||||
Parameter | Type | Description | ||||||
entity | Entity |
![]() |
Entity to be added to the entity selection | |||||
Result | EntitySelection |
![]() |
Entity selection including the added entity | |||||
The entitySelection.add( ) function adds the specified entity to the entity selection and returns the modified entity selection.
Note: This method modifies the original entity selection.
Warning: The entity selection must be non-shareable, i.e. it has been created for example by dataClass.newSelection( ) or Create entity selection, otherwise entitySelection.add( ) will return an error. Shareable entity selections do not accept the addition of entities. For more information, please refer to the Shareable vs Alterable entity selections paragraph.
The entity is added depending on the entity selection is ordered or not (see Ordered vs Unordered entity selections):
The modified entity selection is returned by the function, so that function calls can be chained.
An error occurs if entity and the entity selection are not related to the same dataClass. If the entity to be added is Null, no error is raised.
var $employee : cs.EmployeeEntity
var $employees : cs.EmployeeSelection
$employees:=ds.Employee.query("lastName = :1";"S@") //shareable entity selection
$employee:=ds.Employee.new()
$employee.lastName:="Smith"
$employee.save()
$employees:=$employees.copy() //Get a non-shared version of the entity selection
$employees.add($employee) //The $employee entity is added to the $employees entity selection
entitySelection.and( )
entitySelection.drop( )
entitySelection.minus( )
Product: 4D
Theme: ORDA - EntitySelection
Created: 4D v17
Modified: 4D v18 R5
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)