This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19.8
collection.indices( )

collection.indices( ) 


 

collection.indices ( queryString {; value}{; value2 ; ... ; valueN} ) -> Function result 
Parameter Type   Description
queryString  Text in Search criteria
value  Mixed in Value(s) to compare when using placeholder(s)
Function result  Collection in 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.

Example  

 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]



See also 

collection.query( )
dataClass.query( )

 
PROPERTIES 

Product: 4D
Theme: Collections
Number: 805265

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v16 R6

 
ARTICLE USAGE

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)