ALLVALUES()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to return all values for a numeric expression against the current cursor for a matching series of keys

Syntax

ALLVALUES(<expN> [[, <for condition> [, <key expression>]] [,<tag name or indexorder>] )

See Also

AVERAGE, COUNT, SUM, TOTAL, AMAX(), AMIN(), AVGVALUES(), CNTVALUES(), MAX(), MAXVALUES(), MIN(), MINVALUES()

Description

The ALLVALUES() function returns the results of SUMVALUES(), MINVALUES(), MAXVALUES(), AVGVALUES() and CNTVALUES() for the value of <expN> over a matching series of keys. The required <expN> parameter should be a numeric expression referencing one or more columns from the current cursor. If none of the optional parameters is specified, then the keys matching the current key is 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.

This function returns a dynamic array containing 5 elements which can be referenced as "CNT", 'MAX", "MIN", "AVG", "SUM".

After completion, all record pointers and indexes are returned to their original positions.

Example

use customer
m_values = allvalues(balance, between(expiry_date, date(), date()+7), "Mr", "title")
echo m_values