TOTAL Command Sums Only One Key FieldLast reviewed: April 17, 1995Article ID: Q88889 |
The information in this article applies to:
SUMMARYIn FoxBASE+ and FoxPro, the TOTAL command computes the total of only one key field. This field must be the first field in the index expression.
Syntax
TOTAL TO <file> ON <key> [<scope>] [FIELDS <list>] [FOR <expL>] [WHILE <expL>] MORE INFORMATIONThe TOTAL command computes the total of the numeric fields of records in the currently selected database that match the <key> expression and places the total into the corresponding fields of records in a second database. The current database must be sorted on the <key> expression or have an index enabled on the <key> expression. If the output <file> does not already exist, FoxBASE+ or FoxPro creates the file with a .DBF default extension. By default, the TOTAL command totals all numeric fields unless the FIELDS clause is specified. If the numeric fields in the database file that receives the totals are not wide enough to contain the totals, numeric overflow may occur. When overflow occurs, FoxBASE+ and FoxPro conserve the most- significant digits of the totals, as follows:
Example
USE Video INDEX Rating TOTAL TO V_stotal ON Rating FIELDS Rating, Num_sold * V_stotal was not predefined. USE V_stotal LIST rating, num_sold Record# RATING NUM_SOLD 1 G 675 2 N/R 2205 3 PG 21244 4 R 14351 |
Additional reference words: FoxDos 1.00 1.01 1.02 1.21 2.00 2.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |