This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
collection.indices( )
|
collection.indices ( queryString {; value}{; value2 ; ... ; valueN} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
queryString | Text |
![]() |
Search criteria | |||||
value | Mixed |
![]() |
Value(s) to compare when using placeholder(s) | |||||
Function result | Collection |
![]() |
Element index(es) matching queryString in the collection | |||||
The collection.indices( ) method works exactly the same as the collection.query( ) method but returns indexes, in the original collection, of object collection elements that match the queryString search conditions, and not elements themselves. Indexes are returned in ascending order.
Note: This method does not modify the original collection.
The queryString parameter uses the following syntax:
propertyPath comparator value {logicalOperator propertyPath comparator value}
For a detailed description of the queryString and value parameters, please refer to the dataClass.query( ) method.
C_COLLECTION($c)
$c:=New collection
$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))
$icol:=$c.indices("name = :1";"Cleveland") // $icol=[0]
$icol:=$c.indices("zc > 35040") // $icol=[0,3,4]
Product: 4D
Theme: Collections
Number:
805265
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)