if you wish to reset the total add nTotal = 0 after you print it.
You can also run a query which is faster
SELECT location, SUM(cost) as total GROUP BY location INTO CURSOR loctotals
use this table to fill the locations totals
REPLACE loctotal WITH loctotals.total for location = loctotals.location
Main Topics
Browse All Topics





by: CaptainCyrilPosted on 2009-07-02 at 13:29:56ID: 24767456
You can have it in the cursor, in the FRX report by using SUM and grouping or inside Excel Automation.
How I would do it is add a running total and it displays when the location changes and the total is not 0.
nTotal = 0
nLocation = -1
loop the cursor
IF nLocation <> location AND nTotal <> 0
print the total
ENDIF
nLocation = location
nTotal = nTotal + cost
endloop