Difference between revisions of "AVGVALUES()"
Line 28: | Line 28: | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:Data Analysis Functions]] | [[Category:Data Analysis Functions]] | ||
+ | [[Category:Lianja VFP Extensions]] | ||
+ | [[Category:VFP Function Extensions]] | ||
[[Category:Lianja VFP Extensions]] | [[Category:Lianja VFP Extensions]] | ||
[[Category:VFP Function Extensions]] | [[Category:VFP Function Extensions]] |
Latest revision as of 07:20, 10 December 2012
Contents
Purpose
Function to return the average value of a column for a matching series of keys
Syntax
AVGVALUES(<expN> [, <for condition> [, <key-expression>]])
See Also
ALLVALUES(), AVERAGE, COUNT, AMAX(), AMIN(), CNTVALUES(), MAX(), MAXVALUES(), MIN(), MINVALUES(), SUM, SUMVALUES(), TOTAL
Description
The AVGVALUES() function returns the average value of <expN> for the matching series of keys. The required <expN> parameter must be a column name from a table. If none of the optional parameters is specified, then the average value for the number of keys matching the current key is returned. An optional <for condition> can be specified to restrict the rows included in the operation. You can also optionally specify a <key-expression> to be used instead of the current key. After completion, all record pointers and indexes are returned to the original position.
Example
use customer order title // Average the balance column for // the number of records matching the current key total_balance = avgvalues(balance) // Average the balance column for // the number of records matching the key "Mr" m_male = avgvalues(balance, .T., "Mr") // Average the balance column for the number of records matching // the current key with an expiry date < today m_expired = avgvalues(balance, expiry < date())