This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
entitySelection.{attributeName}
|
entitySelection.{attributeName} -> Result | ||||||||
Parameter | Type | Description | ||||||
Result | Collection, EntitySelection |
![]() |
Projection of attribute values for the entity selection | |||||
Any dataclass attribute can be used as a property of an entity selection to return a "projection" of values for the attribute in the entity selection. Projected values can be a collection or a new entity selection, depending on the kind (storage or relation) of the attribute.
When a relation attribute is used as a property of an entity selection, the result is always another entity selection, even if only one entity is returned. In this case, if no entities are returned, the result is an empty entity selection.
Note: For more information on attribute kind, please refer to the dataClassAttribute.kind property description.
If the attribute does not exist in the entity selection, an error is returned.
Projection of storage values:
C_COLLECTION(firstNames)
$entitySelection:=ds.Employee.all()
firstNames:=$entitySelection.firstName // firstName type is string
The resulting collection is a collection of strings, for example:
[ "Joanna", "Alexandra", "Rick" ]
Projection of related entity:
C_OBJECT($es;$entitySelection)
$entitySelection:=ds.Employee.all()
$es:=$entitySelection.employer // employer is related to a Company dataClass
The resulting object is an entity selection of Company with duplications removed (if any).
Projection of related entities:
C_OBJECT($es)
$es:=ds.Employee.all().directReports // directReports is related to Employee dataclass
The resulting object is an entity selection of Employee with duplications removed (if any).
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)