This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
entitySelection.extract( )
|
entitySelection.extract ( propertyPath {; targetPath}{; propertyPath2 ; targetPath2 ; ... ; propertyPathN ; targetPathN}{; option}) -> Result | ||||||||
Parameter | Type | Description | ||||||
propertyPath | Text |
![]() |
Property path whose values must be extracted to the new collection | |||||
targetPath | Text |
![]() |
Target property path or property name | |||||
option | Longint |
![]() |
ck keep null: include null properties in the returned collection (ignored by default). Parameter ignored if targetPath passed. | |||||
Result | Collection |
![]() |
Collection containing extracted values | |||||
The entitySelection.extract( ) method returns a collection containing propertyPath values extracted from the entity selection.
propertyPath can refer to:
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.
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 is a collection of Strings
$firstnames:=ds.Teachers.all().extract("firstname")
//
//$addresses is a collection of entities related to dataclass Address
//Null values for address are extracted
$addresses:=ds.Teachers.all().extract("address";ck keep null)
//
//
//$mailing is a collection of objects with properties "who" and "to"
//"who" property content is String type
//"to" property content is entity type (Address dataclass)
$mailing:=ds.Teachers.all().extract("lastname";"who";"address";"to")
//
//
//$mailing is a collection of objects with properties "who" and "city"
//"who" property content is String type
//"city" property content is String type
$mailing:=ds.Teachers.all().extract("lastname";"who";"address.city";"city")
//
//$teachers is a collection of objects with properties "where" and "who"
//"where" property content is String
//"who" property content is an entity selection (Teachers dataclass)
$teachers:=ds.Address.all().extract("city";"where";"teachers";"who")
//
//$teachers is a collection of entity selections
$teachers:=ds.Address.all().extract("teachers")
Product: 4D
Theme: ORDA - EntitySelection
Created: 4D v18 R3
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)