Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rotating a grid
Message
De
13/02/2004 15:42:29
 
 
À
13/02/2004 10:33:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00867251
Message ID:
00877267
Vues:
22
>>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 !!!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform