This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
entitySelection.and( )
|
entitySelection.and ( entity | entitySelection ) -> Result | ||||||||
Parameter | Type | Description | ||||||
entity | entitySelection | Entity, EntitySelection |
![]() |
Entity or entity selection to intersect with | |||||
Result | EntitySelection |
![]() |
New entity selection with the result of intersection with logical AND operator | |||||
The entitySelection.and( ) method combines the entity selection with an entity or entitySelection parameter using the logical AND operator; it returns a new, unordered entity selection that contains only the entities that are referenced in both the entity selection and the parameter.
Note: You can compare ordered and/or unordered entity selections. The resulting selection is always unordered. For more information, please refer to the Ordered vs Unordered entity selections paragraph in the 4D Developer Guide.
If the original entity selection or the entitySelection parameter is empty, or if the entity is Null, an empty entity selection is returned.
If the original entity selection and the parameter are not related to the same dataClass, an error is raised.
C_OBJECT($employees1;$employee;$result)
$employees1:=ds.Employee.query("lastName = :1";"H@") //The $employees1 entity selection contains the entity with primary key 710 and other entities
//for ex. "Colin Hetrick" / "Grady Harness" / "Sherlock Holmes" (primary key 710)
$employee:=ds.Employee.get(710) // Returns "Sherlock Holmes"
$result:=$employees1.and($employee) //$result is an entity selection containing only the entity with primary key 710 ("Sherlock Holmes")
We want to have a selection of employees named "Jones" who live in New York:
C_OBJECT($sel1;$sel2;$sel3)
$sel1:=ds.Employee.query("name =:1";"Jones")
$sel2:=ds.Employee.query("city=:1";"New York")
$sel3:=$sel1.and($sel2)
Product: 4D
Theme: ORDA - EntitySelection
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)