4D v19

collection.min( )

Home

 
4D v19
collection.min( )

collection.min( )  


 

The collection.min( ) method returns the element with the smallest value in the collection (the first element of the collection as it would be sorted in ascending order using the collection.sort( ) method).

Note: This method does not modify the original collection.

If the collection contains different types of values, the collection.min( ) method will return the minimum value within the first element type in the type list order (see collection.sort( ) description).

If the collection contains objects, pass the propertyPath parameter to indicate the object property whose minimum value you want to get.

If the collection is empty, collection.min( ) returns Undefined.

Example  

 C_COLLECTION($col)
 $col:=New collection(200;150;55)
 $col.push(New object("name";"Smith";"salary";10000))
 $col.push(New object("name";"Wesson";"salary";50000))
 $col.push(New object("name";"Alabama";"salary";10500))
 $min:=$col.min() //55
 $minSal:=$col.min("salary") //10000
 $minName:=$col.min("name") //"Alabama"



See also 

collection.max( )
Min

 
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)