4D v19

collection.indices( )

Home

 
4D v19
collection.indices( )

collection.indices( )  


 

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

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

 
ARTICLE USAGE

4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)