Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to sum a column on a grid?
Message
From
07/12/2000 06:01:54
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00449977
Message ID:
00450281
Views:
30
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform