Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select slows down when using (BUFFERING=.T.)
Message
From
26/05/2009 17:19:42
 
 
To
26/05/2009 16:06:29
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01402021
Message ID:
01402097
Views:
65
I have to sum all child records each time the user changes row or column in the grid. The child records are not saved yet. They may have changed the Qty or Price, or added or deleted a record, so I need to update the total as they navigate around in the grid. I do not save the records until the user has entered them all and clicks the Save button.

The let's them see the total before saving.



>>I have a SQL statement in a form method that I call from the AfterRowColChange() event of my input grid (see code below). The purpose it total the line item prices as the user is adding rows to the grid.
>>
>>Lparameters tiQuoteNo
>>*--------------------------------------------------------------------------
>>* Calculates the total quoted price all line items on the Quote.
>>* Stores the result into thisform.nSummaryQuoteTotal property
>>*--------------------------------------------------------------------------
>>
>> Select Sum(qty*price);
>> From Quote With (BUFFERING = .t.);
>> Where Quote.quote_no=tiQuoteNo and Quote.print=.t.;
>> Into Array laQuoteTotal
>> 
>> thisform.nQuoteTotalPrice=Nvl(laQuoteTotal, 0)
>> 
>> Return thisform.nQuoteTotalPrice
>>
>
>Why are you using SQL to do this? You've already got all the data at hand, just save the record pointer, SUM() and restore it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform