Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select slows down when using (BUFFERING=.T.)
Message
De
26/05/2009 17:19:42
 
 
À
26/05/2009 16:06:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01402021
Message ID:
01402097
Vues:
67
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform