[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
+---------------------------------+
| TOTAL |
+---------------------------------+
TOTAL TO <file> ON <expr>
[FIELDS <fields list>]
[<scope>] [FOR <expL1>]
[WHILE <expL2>]
[NOOPTIMIZE]
-----------------------------------
Totals numeric fields in selected database.
-----------------------------------
<file>
Output file. If <file> does not exist, FoxPro creates it and assigns
it a default extension of .DBF.
<expr>
Index expression. Selected database must be sorted or indexed on
<expr>. A separate total is calculated for each set of records with a
unique index key value. The results are placed into corresponding
records in a second database. One record is created in <file> for each
unique index key value.
If the numeric fields in the database file that accept the totals are
not wide enough to contain the totals, numeric overflow may occur. When
numeric overflow occurs, FoxPro conserves the most significant portions
of the totals.
FIELDS <fields list>
By default, all numeric fields are totaled unless a FIELDS <list> is
included.
<scope>
Range of records to total. Only the records that fall within the
specified <scope> are included in the total. Default scope is ALL.
FOR <expL1>
Only records that satisfy the logical condition <expL1> are included in
the totals. For best performance, use an optimizable expression in the
FOR clause.
WHILE <expL2>
Records from selected database are included in the totals as long as
the logical expression <expL2> evaluates to true (.T.).
NOOPTIMIZE
Disables Rushmore optimization of TOTAL. For more information on
NOOPTIMIZE, see SET OPTIMIZE.
+---------------------------------+
| Example |
+---------------------------------+
USE customer
INDEX ON state + city TO stcity
TOTAL ON state + city TO custotal
This example creates a database named CUSTOTAL which contains totals
from the CUSTOMER database. For each unique city and state combination
in CUSTOMER, a new record is created in the CUSTOTAL database.
-----------------------------------
See Also: AVERAGE, CALCULATE, SET OPTIMIZE, SUM
-----------------------------------
See Also:
AVERAGE
CALCULATE
SET OPTIMIZE
SUM
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson