Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Christian Tabligan
  Where is Christian Tabligan?
 Bacolod City, Neg. Occ.
 Philippines
 Christian Tabligan
 To: piyush Vaishnawswami
  Where is piyush Vaishnawswami?
 Rajkot
 India
 piyush Vaishnawswami
 Tags
Subject: RE: Grid Grouoing
Thread ID: 268947 Message ID: 269013 # Views: 53 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Grids
Date: Friday, July 16, 2010 2:14:21 AM         
   


> Hello expert,
>
> how to display group total in vfp grid.
>
>
>
> it is possible?
>
> Piyush

Please see the attached file below. Just uncomment the commented code. Dynamicforecolor doesn't exist in VFP6.

Example #1:
set safety off
create table temp (letter c(1), amount n(4))
insert into temp values ("A", 10)
insert into temp values ("A", 20)
insert into temp values ("B", 20)
insert into temp values ("B", 13)
insert into temp values ("C", 16)
insert into temp values ("C", 13)
insert into temp values ("C", 30)
insert into temp values ("D", 41)

SELECT letter, sum(amount) as amount FROM temp GROUP BY letter into cursor cur_result
SELECT letter, "        " as dummy, amount from cur_result;
union all;
SELECT "", "Total" as dummy, sum(amount) from cur_result;
INTO CURSOR cur_dummy


Sample Output:



Example #2:

set safety off
close all
create table temp (item c(1), qty n(2), amount n(4))
insert into temp values ("A", 2, 10)
insert into temp values ("A", 2, 20)
insert into temp values ("B", 3, 20)
insert into temp values ("B", 4, 13)
insert into temp values ("C", 2, 16)
insert into temp values ("C", 5, 13)
insert into temp values ("C", 2, 30)
insert into temp values ("D", 6, 41)

SELECT item, LTRIM(STR(SUM(qty))) as Quantity, LTRIM(STR(SUM(Amount))) as Amount;
GROUP BY 1 FROM temp;
UNION ALL;
SELECT "   ", LTRIM("Total"), LTRIM(STR(SUM(Amount))) FROM temp


Sample Output:



Sample Project:

https://www.foxite.com/uploads/7b3d7ff9-2772-487e-933f-1e6756707cd2.rar

Best Regards,

CriZ (,")

"Happiness is real when shared."

ENTIRE THREAD

Grid Grouoing Posted by piyuhsh vaishnavswami @ 7/15/2010 3:31:42 PM
RE: Grid Grouoing Posted by Rahul Maudgill @ 7/15/2010 3:47:51 PM
RE: Grid Grouoing Posted by tushar @ 7/15/2010 3:58:28 PM
RE: Grid Grouoing Posted by piyuhsh vaishnavswami @ 7/15/2010 9:24:54 PM
RE: Grid Grouoing Posted by Yousfi Benameur @ 7/15/2010 11:57:28 PM
RE: Grid Grouoing Posted by Anders Altberg @ 7/16/2010 12:25:31 AM
RE: Grid Grouoing Posted by Christian Tabligan @ 7/16/2010 2:14:21 AM
RE: Grid Grouoing Posted by mk sharma @ 7/17/2010 9:08:20 AM
RE: Grid Grouoing Posted by piyuhsh vaishnavswami @ 7/18/2010 11:32:02 AM
RE: Grid Grouoing Posted by Anders Altberg @ 7/18/2010 11:59:07 AM
RE: Grid Grouoing Posted by Christian Tabligan @ 7/19/2010 6:36:06 AM