Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Binod Binani
  Where is Binod Binani?
 Kolkata
 India
 Binod Binani
 Tags
Subject: RE: Totals in Buffer Mode
Thread ID: 112549 Message ID: 112559 # Views: 1 # Ratings: 1
Version: Visual FoxPro 6 Category: Grids
Date: Thursday, November 09, 2006 4:36:39 PM         
   


> Hello experts
>
> Mytable.dbf having Dates,Qnty (n,6) fields.
> In Entry form in i am using Mytable in buffer mode 5.
>
> I am using grid1 & pupulated with mytable
>
> On clicking "ADD" command-button I am adding new blank
> record in grid and & user can put certain numering data as quantity.
>
> User goes on adding few records and At certain point user
> may have total of Quantity fields which he have enterd.
>
> for this I am using :
>
> Select sum(qnty) into array myarray from mytable
>
> but it shows total of all Qnty in the file (not of current records
> which yet not saved from buffer to table )
>
> whats wrong????
> is there any better way????
>
> Please help
>
>
>
>
> new to vfp


Further to what Frank gave you, what you are seeing is normal behaviour. The SELECT command goes to the table, not your cursor. If you want to total the records in your grid, you can loop through the cursor.
SELECT MyTable
lntotal = 0
SCAN FOR llSomeConditon
   lntotal = lnTotal + MyTable.AmountField
ENDSCAN


As Frank and Borislav have suggested, you can use the WITH BUFFERING clause in VFP 9. This may be another reason to upgrade.

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

Totals in Buffer Mode Posted by Binod Binani @ 11/9/2006 3:14:44 PM
RE: Totals in Buffer Mode Posted by Frank Cazabon @ 11/9/2006 3:23:17 PM
RE: Totals in Buffer Mode Posted by Borislav Borissov @ 11/9/2006 3:24:06 PM
RE: Totals in Buffer Mode Posted by Ken Murphy @ 11/9/2006 4:30:07 PM
RE: Totals in Buffer Mode Posted by Borislav Borissov @ 11/9/2006 6:58:51 PM
RE: Totals in Buffer Mode Posted by Ken Murphy @ 11/9/2006 9:04:48 PM
RE: Totals in Buffer Mode Posted by Ken Murphy @ 11/9/2006 4:36:39 PM