Difference between revisions of "SUMVALUES()"
Barrymavin (Talk | contribs) (→See Also) |
Yvonne.milne (Talk | contribs) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Function to returns the total value of a column for a matching series of keys | Function to returns the total value of a column for a matching series of keys | ||
− | |||
==Syntax== | ==Syntax== | ||
Line 7: | Line 6: | ||
==See Also== | ==See Also== | ||
− | [[AVERAGE]], [[COUNT]], [[SUM]], [[TOTAL]], [[AMAX()]], [[AMIN()]], [[AVGVALUES()]], [[CNTVALUES()]], [[MAX()]], [[MAXVALUES()]], [[MIN()]], [[MINVALUES | + | [[ALLVALUES()]], [[AVERAGE]], [[COUNT]], [[SUM]], [[TOTAL]], [[AMAX()]], [[AMIN()]], [[AVGVALUES()]], [[CNTVALUES()]], [[MAX()]], [[MAXVALUES()]], [[MIN()]], [[MINVALUES()]] |
==Description== | ==Description== | ||
− | The SUMVALUES() function returns the total value of <expN> for a matching series of keys. The required <expN> parameter should be a numeric expression referencing | + | The SUMVALUES() function returns the total value of <expN> for a matching series of keys. The required <expN> parameter should be a numeric expression referencing columns from the current workarea (or cursor). If none of the optional parameters is specified, then the keys matching the current key are scanned. An optional <for condition> can be specified to restrict the rows included in the sum operation. You can also optionally specify a <key expression> to perform the sum on instead of the current key. An optional <tag name or index order> can be specified also. |
After completion, all record pointers and indexes are returned to their original positions. | After completion, all record pointers and indexes are returned to their original positions. | ||
Line 25: | Line 24: | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
+ | [[Category:Data Analysis Functions]] |
Latest revision as of 11:13, 28 September 2015
Contents
Purpose
Function to returns the total value of a column for a matching series of keys
Syntax
SUMVALUES(<expN> [[, <for condition> [, <key expression>]] [,<tag name or indexorder>] )
See Also
ALLVALUES(), AVERAGE, COUNT, SUM, TOTAL, AMAX(), AMIN(), AVGVALUES(), CNTVALUES(), MAX(), MAXVALUES(), MIN(), MINVALUES()
Description
The SUMVALUES() function returns the total value of <expN> for a matching series of keys. The required <expN> parameter should be a numeric expression referencing columns from the current workarea (or cursor). If none of the optional parameters is specified, then the keys matching the current key are scanned. An optional <for condition> can be specified to restrict the rows included in the sum operation. You can also optionally specify a <key expression> to perform the sum on instead of the current key. An optional <tag name or index order> can be specified also.
After completion, all record pointers and indexes are returned to their original positions.
Example
use customer order title // Sum the balance column for the number of records matching the current key total_balance = sumvalues(balance) // Sum the balance column for the number of records matching the key "Mr" m_male = sumvalues(balance, .T., "Mr") //Sum the balance column for the number of records matching the current key with an expiry date < today m_expired = sumvalues(balance, expiry < date())