Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rotating a grid
Message
From
13/02/2004 15:42:29
 
 
To
13/02/2004 10:33:34
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00867251
Message ID:
00877267
Views:
21
>>I would like to take an existing table and have it display the data in a grid, but I need the grid to be rotated 90 degrees so that:
>>
>>
>>
>>           Field 1      Field 2    Field 3
>>--------------------------------------------------
>>Record 1
>>--------------------------------------------------
>>Record 2
>>--------------------------------------------------
>>Record 3
>>--------------------------------------------------
>>
>>becomes:
>>
>>           Record 1      Record 2    Record 3
>>--------------------------------------------------
>>Field 1
>>--------------------------------------------------
>>Field 2
>>--------------------------------------------------
>>Field 3
>>--------------------------------------------------
>>
>>
>>Is there an easy way to accomplish this that I am just overlooking?
>>
>>TIA,
>
>Phil,
>
>#Define MAXFIELDS 255
>Local ix
>Create Cursor test (Field1 i, Field2 c(15), Field3 d)
>For ix = 1 To MAXFIELDS
>  Insert Into test Values (m.ix,Sys(2015),Date()+m.ix)
>Endfor
>Local Array aMaxLen[1],aStruc[Reccount(),4]
>Select Max(Max(;
>  Len(Trim(Transform(Field1))),;
>  Len(Trim(Transform(Field2))),;
>  Len(Trim(Transform(Field3))))) ;
>  from test ;
>  into Array aMaxLen
>Local lcTempFile, lcTemp
>lcTempFile = Sys(2015)+'.tmp'
>Set Textmerge To Memvar m.lcTemp Noshow
>Set Textmerge On
>For ix=1 To Fcount()
>  Scan
>\\<<Evaluate(Field(m.ix))>>,
>  Endscan
>\
>Endfor
>Set Textmerge To
>Set Textmerge Off
>Strtofile(m.lcTemp,m.lcTempFile)
>
>aStruc = 0
>For ix=1 To Alen(aStruc,1)
>  aStruc[m.ix,1] = 'rec'+Ltrim(Str(m.ix))
>  aStruc[m.ix,2] = 'C'
>  aStruc[m.ix,3] = aMaxLen
>Endfor
>Create Cursor Rotated From Array aStruc
>Append From (m.lcTempFile) Type Delimited
>Erase (m.lcTempFile)
>Browse
>
Cetin

Cetin, your code is BRILLIANT !!!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform