4D v17.4

entitySelection.sum( )

Home

 
4D v17.4
entitySelection.sum( )

entitySelection.sum( )  


 

The entitySelection.sum( ) method returns the sum for all attributePath values in the entity selection.

entitySelection.sum( ) returns 0 if the entity selection is empty.

The sum can only be done on values of number type. If the attributePath type is object, only numerical values are taken into account for the calculation (other value types are ignored). In this case, if attributePath leads to a property that does not exist in the object or does not contain any numeric values, entitySelection.sum( ) returns 0.

An error is returned if:

Example  

 C_OBJECT($sel)
 C_REAL($sum)
 
 $sel:=ds.Employee.query("salary < :1";20000)
 $sum:=$sel.sum("salary")



See also 

entitySelection.count( )

 
PROPERTIES 

Product: 4D
Theme: ORDA - EntitySelection

 
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)