Hi All:
I found that it pays from time to time to check out various features of
FoxPro that I don't use extensively. I modified the following from the
Help file about the system variable, _TALLY:
------------------------------------------------------------------------
_TALLY =
Returns number of records processed by the most recently executed
table command.
Certain table/.DBF processing commands return information about their
status ("talk") while they execute. When such a command finishes
executing, it displays the number of records it processed (if you have
SET TALK ON), and stores this number to the _TALLY system memory variable.
Commands that return status information:
APPEND FROM PACK
AVERAGE REINDEX
CALCULATE REPLACE
COPY TO SELECT - SQL
COUNT SORT
DELETE SUM
INDEX TOTAL
JOIN UPDATE
When you start FoxPro, _TALLY is set to zero. Executing one of the
commands above replaces _TALLY with the number of records the
command processed.
This example uses SELECT to return the number of customers in California.
The result is automatically stored to _TALLY. The _TALLY value is
displayed.
SELECT * FROM Customer ;
WHERE state = 'CA' ;
INTO CURSOR temp
? _TALLY
-------------------------------------------------------------------------
Because it works so well with so many commands, I looked back through some
of my old code and found some improvements. For example:
SUM amount TO jnTot FOR invdate > {12/31/96}
COUNT TO jnCnt FOR invdate > {12/31/96} is reduced to
SUM TO jnTot FOR invdate > {12/31/96}
jnCnt = _TALLY saving I/O processing time
and
INDEX ON invdate FOR amount > 1000.00
COUNT TO jnInv FOR amount > 1000.00 is reduced to
INDEX ON invdate FOR amount > 1000.00
jnInv = _TALLY saving I/O processing time
Just remember to STORE _TALLY to a memvar immediately after the most
recently executed table command as another table command will alter _TALLY!
David in Dallas.
--- Maximus/2 3.01
---------------
* Origin: * MacSavvy OS/2 BBS * Dallas, Texas * 972-250-4479 * (1:124/1208)
|