Difference between revisions of "ALLVALUES()"

From Recital Documentation Wiki
Jump to: navigation, search
(Description)
(Example)
 
(One intermediate revision by one user not shown)
Line 18: Line 18:
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
use customer order title
+
use customer
m_values = allvalues(balance, .T., "Mr")
+
m_values = allvalues(balance, between(expiry_date, date(), date()+7), "Mr", "title")
 
echo m_values
 
echo m_values
 
</code>
 
</code>
 
  
 
==Products==
 
==Products==

Latest revision as of 04:48, 20 June 2010

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


Description

The ALLVALUES() function returns the results of CNTVALUES(), 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

Products

Recital, Recital Server