Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / FoxPro / Grids / July 2008

Tip: Looking for answers? Try searching our database.

Sum Columns in grid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NeoX - 09 Jul 2008 04:50 GMT
Hallo any one,I'm totally new in Visual FoxPro, I want to know how to sum
total value in whole 1 columns on the grid

thank you
Stefan Wuebbe - 09 Jul 2008 08:12 GMT
> Hallo any one,I'm totally new in Visual FoxPro, I want to know how to sum total value in
> whole 1 columns on the grid

Do you want something like a "running totals" column? If so, you can do
a SQL self-join, e.g.:
CREATE CURSOR temp (idField Int, amount Num(15,2))
INSERT INTO temp VALUES (1, 11.3)
INSERT INTO temp VALUES (2, 8.7)
INSERT INTO temp VALUES (3, 10)

SELECT T1.idField, T1.amount, SUM(T2.amount) ;
   FROM temp T1 ;
       JOIN temp T2 ON T2.idField <= T1.idField ;
   GROUP BY 1, 2 ORDER BY 1IOW, when you want to display any calculated columns in a
grid, your best bet may be to create a (parameterized) Local View on the actual data and
the use that view as yourGrid.RecordSource.hth-Stefan
Anders Altberg - 15 Jul 2008 13:48 GMT
Assuming the third column contains the values you want to sum and that the
cursor is TableBuffered (5)

Function Grid.AfterRowColChange
Lparameters nColIndex
If nColIndex = 3 And This.RowColChange>0
Local lcCol
lcCol=This.Columns(3).ControlSource
Select Sum(&lcCol) From (This.RecordSource) With (Buffering=.T.) Into Array
aTmp
Thisform.Text1.Value=aTmp(1)
Endif

-Anders

> Hallo any one,I'm totally new in Visual FoxPro, I want to know how to sum
> total value in whole 1 columns on the grid
>
> columnname
> thank you
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.