Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Making a 'grid' table
Message
From
29/05/1998 15:12:03
 
 
To
29/05/1998 11:46:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00102892
Message ID:
00103210
Views:
22
Goodness, that's quite a bit of code there. I'll add it to the list of things to try. I've got a lot of help in this thread, and I'm sure at least one of these will work.

Thanks!

-Michelle

>Hi Michelle,
>A lot of ways and so many replies that I couldn't follow. Sure you should have a solution by now. First genxtab, vfpxtab series come to mind and good for this. Provided your data is something like :
>leftside topfields cellvalue
>Z1       Dest1          1200
>Z1       Dest2          2000
>Z2       Dest1          3000
>Z1       Dest3         12000
>....
and distinct count on topfields is suitable to generate an xtab (<=255) here is a simple xtab routine :
>* cOurtable is table name
>*Leftside, topfields, cellvalue should be parametric or changed manually
>*and correspond to above structure
>lparameters cOurTable
>select padr("AAAAAAA", fsize("TopFields",cOurTable)," ") as Field_name, ;
>   "C" as Field_type, ;
>   fsize("LeftSide",cOurTable) as field_len, ;
>   0 as field_dec ;
>   from (cOurTable) ;
>   union ;
> (select distinct chrtran(topfields," ","_") as Field_name, ;
>   "Y" as Field_type, ;
>   8 as field_len, ;
>   0 as field_dec ;
>   from (cOurTable) ;
>   where !empty(topfields) ) ;
>   into array aMyStruc
>aMyStruc[1,1] = "Zones"   && SQL would order it so "AAAAA" is top elem
>select distinct LeftSide ;
>	from (cOurTable) ;
>    where !empty(leftside)  ;
>	into array aMyZones
>create cursor myXtab from array aMyStruc
>for ix = 1 to alen(aMyZones,1)
> scatter memvar blank
> m.zones = aMyZones[ix]
> select chrtran(TopFields," ","_"), CellValue ;
> 	from (cOurTable) ;
> 	where LeftSide == aMyZones[ix] ;
> 	into array aCellValues
> for jx = 1 to alen(aCellValues,1)
> 	store aCellValues[jx,2] to ("m."+aCellValues[jx,1])
> endfor	
> insert into myXtab from memvar
>endfor
>browse 	
Cetin
Previous
Reply
Map
View

Click here to load this message in the networking platform