4D v17.4

collection.count( )

Home

 
4D v17.4
collection.count( )

collection.count( )  


 

The collection.count( ) method returns the number of non-null elements in the collection.

If the collection contains objects, you can pass the propertyPath parameter. In this case, only elements that contain the propertyPath are taken into account.

Example  

 C_COLLECTION($col)
 C_REAL($count1;$count2)
 $col:=New collection(20;30;Null;40)
 $col.push(New object("name";"Smith";"salary";10000))
 $col.push(New object("name";"Wesson";"salary";50000))
 $col.push(New object("name";"Gross";"salary";10500))
 $col.push(New object("lastName";"Henry";"salary";12000))
 $count1:=$col.count() //$count1=7
 $count2:=$col.count("name") //$count2=3



See also 

collection.length

 
PROPERTIES 

Product: 4D
Theme: Collections

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

 
ARTICLE USAGE

4D Language Reference ( 4D v17)
4D Language Reference ( 4D v17.1)
4D Language Reference ( 4D v17.2)
4D Language Reference ( 4D v17.3)
4D Language Reference ( 4D v17.4)