The entitySelection.extract( ) method returns a collection containing propertyPath values extracted from the entity selection.
propertyPath can refer to:
- a scalar dataclass attribute,
- related entity,
- related entities.
If propertyPath is invalid, an empty collection is returned.
This method accepts two syntaxes.
With this syntax, entitySelection.extract( ) populates the returned collection with the propertyPath values of the entity selection.
By default, entities for which propertyPath is null or undefined are ignored in the resulting collection. You can pass the ck keep null constant in the option parameter to include these values as null elements in the returned collection.
- Dataclass attributes with dataClassAttribute.kind = "relatedEntity" are extracted as a collection of entities (duplications are kept).
- Dataclass attributes with dataClassAttribute.kind = "relatedEntities" are extracted as a collection of entity selections.
With this syntax, entitySelection.extract( ) populates the returned collection with the propertyPath properties. Each element of the returned collection is an object with targetPath properties filled with the corresponding propertyPath properties. Null values are kept (option parameter is ignored with this syntax).
If several propertyPath are given, a targetPath must be given for each. Only valid pairs [propertyPath, targetPath] are extracted.
Note: Entities of a collection of entities accessed by [ ] are not reloaded from the database.
Given the following table and relation:

C_COLLECTION($firstnames;$addresses;$mailing;$teachers)
C_OBJECT($status)
$firstnames:=ds.Teachers.all().extract("firstname")
$addresses:=ds.Teachers.all().extract("address";ck keep null)
$mailing:=ds.Teachers.all().extract("lastname";"who";"address";"to")
$mailing:=ds.Teachers.all().extract("lastname";"who";"address.city";"city")
$teachers:=ds.Address.all().extract("city";"where";"teachers";"who")
$teachers:=ds.Address.all().extract("teachers")