>>>Example: Transpose data by F4, then F1 >>>Table1 >>>F1 F2 F3 F4 >>>AAA 1 1 8/22/02 >>>AAA 2 1 8/22/02 >>>AAA 3 1 8/22/02 >>>BBB 1 1 8/22/02 >>>BBB 2 1 8/23/02 >>>CCC 3 1 8/23/02 >>> >>>Result: >>> >>>F4 F2 F3AAA F3BBB F3CCC >>>8/22/02 1 1 1 - >>>8/22/02 2 1 1 - >>>8/22/02 3 1 - - >>>8/23/02 2 - 1 - >>>8/23/02 3 - - 1 >>>>>
select distinct f1 from myTable into array arrExtraCols >>IF _Tally = 0 >> MESSAGEBOX('No rows to process') >> RETURN >>endif >>&& Assuming 'F3'+F1 values qualify to be a fieldname >>lcExtra = '' >>for ix=1 to alen(arrExtraCols,1) >> lcExtra = lcExtra + ',0x00000000 as F3'+trim(arrExtraCols[ix,1]) >>endfor >>select distinct f4,f2 &lcExtra from myTable into cursor xTabbed readwrite >>scan >> scatter name oRecord >> select myTable >> for ix=3 to fcount('xTabbed') >> locate for f4 = oRecord.f4 and f2 = oRecord.f2 and ; >> upper(f1) = substr(field(ix,'xTabbed'),3) >> store f3 to ('oRecord.'+field(ix,'xTabbed')) >> endfor >> select xTabbed >> gather name oRecord >>ENDSCAN >>browseCetin