Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>sum</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SUM
 Sum numeric expressions and assign results to variables
------------------------------------------------------------------------------
 Syntax

     SUM <nExp list> TO <idVar list>
        [<scope>] [WHILE <lCondition>] [FOR <lCondition>]

 Arguments

     <nExp list> is the list of numeric values to sum for each record
     processed.

     TO <idVar list> identifies the receiving variables to be assigned
     assign the results of the sum.  Variables that either do not exist or
     are not visible are created as private variables.  <idVar list> must
     contain the same number of elements as <nExp list>.

     <scope> is the portion of the current database file to SUM.  The
     default scope is ALL records.

     WHILE <lCondition> specifies the set of records meeting the
     condition from the current record until the condition fails.

     FOR <lCondition> specifies the conditional set of records to SUM
     within the given scope.

 Description

     SUM is a database command that totals a series of numeric expressions
     for a range of records in the current work area and assigns the results
     to a series of variables.  The variables specified in <idVar list> can
     be field, local, private, public, or static.

     Note that the <nExp list> is required and not optional as it is in other
     dialects.

 Examples

     .  This example illustrates the use of SUM:

        LOCAL nTotalPrice, nTotalAmount
        USE Sales NEW
        SUM Price * .10, Amount TO nTotalPrice, nTotalAmount
        //
        ? nTotalPrice               // Result: 151515.00
        ? nTotalAmount              // Result: 150675.00

 Files   Library is CLIPPER.LIB.


See Also: AVERAGE DBEVAL() TOTAL

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson