> 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 >-------------------------------------------------- >>
#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) BrowseCetin