At 21:55 2009-07-18, Sytze de Boer <sytze.k...@gmail.com> wrote:
>Can I SUM data without changing the record position
>
>e.g
>I'm on row 10 in a 20 record table
>I issue the command SUM ALL AMOUNT TO MY_TOTALS
>But I son't want to shift the record position
>
>(I know I could do it as follows, but is there an alternate?)

      You could do an SQL select, but the code is more complex!

>istartonrow=recno()
>SUM ALL AMOUNT TO MY_TOTALS
>go istsrtonrow

      Watch out!  If eof() before the sum, the goto will throw a 
"Record is out of range." error.  To avoid this, I have a couple of 
routines that save position and restore position, roughly

           saverecno()
             if eof()
               return 0
             else
               return recno()

           restorerecno(position)
             if position#0
               goto position
             else
               goto bottom
               skip
             return

Sincerely,

Gene Wirchenko



_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/20090719051504.c83bb98...@marge.leafe.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to