Difference between revisions of "AVGVALUES()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Class==
 
Fields and Records
 
 
 
 
==Purpose==
 
==Purpose==
 
Function to return the average value of a column for a matching series of keys
 
Function to return the average value of a column for a matching series of keys
Line 12: Line 8:
  
 
==See Also==
 
==See Also==
[[AVERAGE]], [[COUNT]], [[AMAX()]], [[AMIN()]], [[CNTVALUES()]], [[MAX()]], [[MAXVALUES()]], [[MIN()]], [[MINVALUES()]], [[SQLVALUES()]], [[SUM]], [[SUMVALUES()]], [[TOTAL]]
+
[[ALLVALUES()]], [[AVERAGE]], [[COUNT]], [[AMAX()]], [[AMIN()]], [[CNTVALUES()]], [[MAX()]], [[MAXVALUES()]], [[MIN()]], [[MINVALUES()]], [[SQLVALUES()]], [[SUM]], [[SUMVALUES()]], [[TOTAL]]
  
  
Line 35: Line 31:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 15:42, 10 February 2012

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(), SQLVALUES(), 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())


Products

Recital Server, Recital