Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>total</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
TOTAL


Syntax:     TOTAL ON <key exp> [<scope>] [FIELDS <field list>] TO
            <file>/(<expC>) [FOR <condition>] [WHILE <condition>]

Purpose:    To summarize records by key value, sum specified numeric
            fields, and copy summary records to a second database file.

Arguments:  <key exp> defines the group of records as encountered
            that produce a new record in the target database file.  To
            make the summarizing operation accurate, the source database
            file should be INDEXed or SORTed on the TOTAL key
            expression.

            <file> is the name of the target file to copy the
            summarized records.  Unless otherwise specified, TOTAL
            assumes a (.dbf) extension.

Options:    Fields: The FIELDS clause specifies the list of numeric
            fields to TOTAL.  If the FIELDS clause is not specified, NO
            numeric fields are totalled.  Instead each numeric field in
            the target file contains the value for the first record
            matching the key expression.

            Scope: The <scope> is the portion of the current
            database file to TOTAL.  The default is ALL.

            Condition: The FOR clause specifies the conditional set
            of records to TOTAL within the given scope.  The WHILE
            clause specifies the set of records meeting the condition
            from the current record until the condition fails.

Usage:      The structure of the target database file Clipper creates is
            identical to the source except that memo fields are not
            copied.  Note that in order to successfully TOTAL numeric
            fields, the source numeric fields must be large enough to
            hold the largest total possible for that numeric field.

Library:    CLIPPER.LIB


----------------------------------- Example --------------------------------

   USE Sales
   INDEX ON Branch + Salesman TO Sales_sum

   key_exp = INDEXKEY(0)
   TOTAL ON &key_exp. FIELDS Amount TO Summary


See Also: AVERAGE SUM

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