This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com
Home
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.
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
collection.length
Product: 4D Theme: Collections Number: 705244
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)