Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using SUM, COUNT, etc. in a form with multiple tables
Message
De
08/11/1998 21:21:35
 
 
À
05/11/1998 12:13:48
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00154405
Message ID:
00155615
Vues:
18
If it is in the case of multiple users working on the same table, this approach won't show the change made by the other person, I am afraid. In my case, I base on back end data.

Well, once again, thank you all very much for the respose to my original question. Here, I have another question. If I want to have an array shared by all the methods in a form and encapsulated only in this form, where should I define the array?

Wei Lin


>Yes for sure. But since this is for grid summing on the fly it's enough and fast to get just back-end values. A simple :
>sumvalue = sumvalue - this.value on gotfocus
>sumvalue = sumvalue + this.value on lostfocus work quite well.
>Cetin
>
>>Problem with SQL is that it won't work on buffered tables ... picks up the "back-end" values - not the current buffered ones
>>
>>>>>>>I have a form with several tables in its data environment. If I want to use SUM to sum a field in one particular table, what should I do? (How can you specify the table in SUM command?) Is there any better way to get a sum of a field in a table without worrying working area while multiple tables exist in a data environment? Thanks in advance.
>>>>>>You can use SQL to sum to an array. So won't worry about current workarea, rec pointer movement etc. ie: select sum(sumfld1), sum(fld2*fld3/3) into array aSums. Further you could set array elements as controlsources of textboxes that would show the sum (so no need for refresh too :).
>>>>>>Cetin
>>>>>
>>>>>Thank you, Cetin. But is there any better way than using SQL? The reason for asking this is that I have multiple tables in the form. When SQL runs it changes the work area which is the whole point that I am trying to avoid.
>>>>>
>>>>>I use a field to show the currect sum of some records in a table(grid) which is editable on the form. In other words, I want to have a textbox on a one-to-many form. Whenever I add/delete/change records in the grid (detail table) or I move the records in the master table, the updated sum of related records in the detail table will be displayed in the textbox.
>>>>
>>>>
>>>>If you SQL to an ARRAY, it does NOT change the selected area. This is what Cetin suggested that you do.
>>>>
>>>>Fred
>>>
>>>
>>>Good point, Fred. Thank you. Cetin, thank you again.
>>>
>>>Wei
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform