This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
collection.extract( )
|
collection.extract ( propertyPath {; targetPath}{; propertyPath2 ; targetPath2 ; ... ; propertyPathN ; targetPathN}{; option}) -> Function result | ||||||||
Parameter | Type | Description | ||||||
propertyPath | Text |
![]() |
Object 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. | |||||
Function result | Collection |
![]() |
New collection containing extracted values | |||||
The collection.extract( ) method creates and returns a new collection containing propertyPath values extracted from the original collection of objects.
Note: This method does not modify the original collection.
The contents of the returned collection depends on the targetPath parameter:
C_COLLECTION($c)
$c:=New collection
$c.push(New object("name";"Cleveland"))
$c.push(New object("zip";5321))
$c.push(New object("name";"Blountsville"))
$c.push(42)
$c2:=$c.extract("name") // $c2=[Cleveland,Blountsville]
$c2:=$c.extract("name";ck keep null) //$c2=[Cleveland,null,Blountsville,null]
C_COLLECTION($c)
$c:=New collection
$c.push(New object("zc";35060))
$c.push(New object("name";Null;"zc";35049))
$c.push(New object("name";"Cleveland";"zc";35049))
$c.push(New object("name";"Blountsville";"zc";35031))
$c.push(New object("name";"Adger";"zc";35006))
$c.push(New object("name";"Clanton";"zc";35046))
$c.push(New object("name";"Clanton";"zc";35045))
$c2:=$c.extract("name";"City") //$c2=[{City:null},{City:Cleveland},{City:Blountsville},{City:Adger},{City:Clanton},{City:Clanton}]
$c2:=$c.extract("name";"City";"zc";"Zip") //$c2=[{Zip:35060},{City:null,Zip:35049},{City:Cleveland,Zip:35049},{City:Blountsville,Zip:35031},{City:Adger,Zip:35006},{City:Clanton,Zip:35046},{City:Clanton,Zip:35045}]
Product: 4D
Theme: Collections
Number:
805251
Created: 4D v16 R6
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)