AVERAGE Average numeric expressions in the current work area ------------------------------------------------------------------------------ Syntax AVERAGE <nExp list> TO <idVar list> [<scope>] [WHILE <lCondition>] [FOR <lCondition>] Arguments <nExp list> is a list of the numeric values to AVERAGE for each record processed. TO <idVar list> identifies a list of receiving variables which will contain the average results. Variables that either do not exist or are not visible are created as private variables. <idVar list> must contain the same number of elements as <nExp list>. <scope> defines the portion of the current database file to AVERAGE. The default scope is ALL. WHILE <lCondition> specifies the set of records meeting the condition from the current record until the condition fails. FOR <lCondition> specifies the conditional set of records to AVERAGE within the given scope. Description AVERAGE calculates the average of one or more numeric expressions to variables for a range of records in the current database file. Zero values are counted in the AVERAGE unless explicitly ruled out with a FOR condition. Examples . This example averages a single numeric field using a condition to select a subset of records from the database file: USE Sales NEW AVERAGE Amount TO nAvgAmount FOR Branch = "100" . This example finds the average date for a range of dates: AVERAGE (SaleDate - CTOD("00/00/00")) ; TO nAvgDays FOR !EMPTY(SaleDate) dAvgDate := CTOD("00/00/00") + nAvgDays Files Library is CLIPPER.LIB.
See Also: DBEVAL() SUM TOTAL
Pingback: C5_TOTAL | Viva Clipper !
Pingback: C5_SUM | Viva Clipper !
Pingback: DB Commands | Viva Clipper !
Pingback: C5 Commands | Viva Clipper !