Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to sum a column on a grid?
Message
De
07/12/2000 06:01:54
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00449977
Message ID:
00450281
Vues:
31
Hello Thanya

A simple technique I sometimes use.

Place a textbox named MyTotal on your form for a use as a total.

In its refresh method place something similar to the following

SELECT (your_table)
CALCULATE SUM (EVAL(your_field) ) to this.value


now whenever you refresh your total field with MyTotal.refresh it will contain the total you want.

you may want to place mytotal,refresh in an event of your grid so this total gets updated whenever you alter some value in your grid.

beforecolumnchange is sometimes a good place to do this. Or you could choose an event attached to the object that is being altered.

Good Luck






> I am working on a parent-child form. The children records are displayed on the grid. The 3rd column of this grid is the item costs and I have to total this column. I would like to display the total cost on the form(but not on the grid)and add total to a field in parent table. Have tried this code without results. can you help ?
>
>update sovereign &&parent table
>set sov_cost = sov_cost(SUM(content_cost)from sov_contents, sovereign)where sovereign.sov_id = sov_contents.sov_id
>
> Thank you in advance.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform