SiMX Help‎ > ‎The Target Platform‎ > ‎Objects‎ > ‎DB Object‎ > ‎

DB.GetStatistics


Platform Objects


Description

Returns an array of aggregate values (Min,Max,Sum,Count,Avg) for the field(s) specified in the input parameter. Select is not needed for this method to operate. Scope object's setup is used for records filtering.


Syntax


Function GetStatistics("FUNC(field_name)"|Array("FUNC(term_name)",...))


Parameters


"FUNC(field_name)"|Array("FUNC(term_name)" (input) - An aggregate function name, or an array of aggregate function names 


Return value


variant - an aggregate value for the aggregate function, which was passed in as a parameter; an array of variants - if an array of aggregate functions was passed in as a parameter, each array element holds an aggregate value for the respective aggregate function.


Example

Sample code

Dim aggregate_values, f1, f2, f3
DB.Scope.Set( "Field1 > 1000" ) 
aggregate_values = DB.GetStatistics( Array( "Count(Field1)", "Sum(Field2)", "Avg(Field3)" ) )


See also


DB.scope
DB.sort
DB.AppendFinish