Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Summing Values in a Grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00601514
Message ID:
00601537
Vues:
41
>>>>IMHO using sum,calculate,scan..endscan etc on a grid for this purpose is unnecessary and overkill. If say you have 10K records you'd be summing all again and again. Another side effect you'd be moving the pointer and then taking it back to where you're (which might not be desired in most cases).
>>>>
>>>>SQL select OTOH doesn't move the pointer and you could get the sum into an array.
>>>>-Once you sum only and only when table is updated.
>>>>-Later you only add difference of value change affecting the sum to sumvalue.
>>>>
>>>>Like slow humans do it;)
>>>>
>>>>Cetin
>>>
>>>Hi Cetin,
>>>
>>>Just want to understand your suggestion:
>>>
>>>When the form appears, you show SUM by doing SQL.
>>>In the InteractiveChange of textbox in a grid you would have:
>>>lnNewVal = this.value
>>>lnDiff = m.lnNewVal - this.OldVal
>>>lnSum = thisform.txtTotal.value
>>>lnSum = m.lnSum+ m.lnDiff
>>>thisform.txtTotal.value = m.lnSum
>>>
>>>and save OldVal in textbox.GotFocus. Right?
>>
>>Close but not quite. Interactivechange is not suitable IMHO. Every digit entry would contribute unnecessarily. I prefer lostfocus. For a sample see Thread #574823 Message #574935
>>Cetin
>
>Thanks, Cetin. I first was going to suggest to use LostFocus, but then thought, may be we want to see changes immediatelly. I agree, LostFocus would be better... I also agree with the usage of TAG property, because otherwise we need to use special class instead of native textbox in the column (I should have mentioned that in my first message).


Yes - LostFocus is the easiest way to go and the way I finally choose. I could not get the "Total" to update as the user typed but that OK.
Rip Ryness
International Falls, MN
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform