Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: prasanna kunder
  Where is prasanna kunder?
 mumbai
 India
 prasanna kunder
 Tags
Subject: RE: How To Do
Thread ID: 365534 Message ID: 365558 # Views: 59 # Ratings: 2
Version: Visual FoxPro 9 Category: Grids
Date: Friday, December 28, 2012 2:21:03 AM         
   


> Hello Experts
>
> I have table like this
>
>
FlatNo   Name  Desc                        amt  
> 201      xyz   sinking fund                 50.00
> 201      xyz   repairs & maintenance fund  100.00
> 201      xyz   water charges                75.00 
> 202      lmn   sinking fund                 50.00
> 202      lmn   repairs & maintenance fund  120.00
> 202      lmn   water charges                75.00 
> 203      abc   sinking fund                 40.00
> 203      abc   repairs & maintenance fund  110.00
> 203      abc   water charges                65.00 
> 
> 
> now i want to fit in grid
> 
> FlatNo   Name   sinking fund repairs & maintenance fund water charges
> 201      xyz           50.00           100.00                75.00
> 202      lmn           50.00           120.00                75.00
> 203      abc           40.00           110.00                65.00
> 
> how to do

>
> pl.guide me
> thanks in advance


TEXT TO lcText NOSHOW
201      xyz   sinking fund                 50.00
201      xyz   repairs & maintenance fund  100.00
201      xyz   water charges                75.00 
202      lmn   sinking fund                 50.00
202      lmn   repairs & maintenance fund  120.00
202      lmn   water charges                75.00 
203      abc   sinking fund                 40.00
203      abc   repairs & maintenance fund  110.00
203      abc   water charges                65.00 
ENDTEXT
STRTOFILE(m.lcText,"xx4.txt")
CREATE CURSOR Xx (flatno N(9),name c(6),descr C(28), amt N(9,2))
APPEND FROM xx4.txt sdf
* VfpXtab.prg requires three columns only to form a proper crosstab 
SELECT name,descr,amt FROM Xx ORDER BY 1,2 INTO CURSOR 'Xtabsource' 
DO (_genxtab) WITH 'Xtab2', .T.
* Add additional column(s) as needed
SELECT DISTINCT Xx.flatno,xtab2.* FROM xx JOIN Xtab2 ON Xx.name=Xtab2.name INTO CURSOR Q2
BROWSE LAST NOWAIT 


result:
Flatno   	Name  	Repairs_maintenancefund	Sinkingfund	Watercharges	
201 xyz 100.00 50.00 75.00
202 lmn 120.00 50.00 75.00
203 abc 110.00 40.00 65.00

-Anders

ENTIRE THREAD

How To Do Posted by prasanna kunder @ 12/27/2012 8:08:28 PM
RE: How To Do Posted by Rick Hodgin @ 12/27/2012 9:21:35 PM
RE: How To Do Posted by prasanna kunder @ 12/27/2012 9:28:20 PM
RE: How To Do Posted by Rick Hodgin @ 12/27/2012 9:38:18 PM
RE: How To Do Posted by Rick Hodgin @ 12/27/2012 9:49:22 PM
RE: How To Do Posted by prasanna kunder @ 12/27/2012 9:58:56 PM
RE: How To Do Posted by Rick Hodgin @ 12/27/2012 10:14:17 PM
RE: How To Do Posted by Anders Altberg @ 12/28/2012 2:21:03 AM
RE: How To Do Posted by prasanna kunder @ 12/29/2012 10:41:30 AM