CREATE cursor test (f1 c(1), f2 c(1)) lcPattx = replicate(',0',186) SELECT f1,f2 &lcPattx ; FROM test ; into cursor Dummy nofilter AFIELDS(aNewStruc) lnTimeColStart = 3 FOR ix = lnTimeColStart to aLen(aNewStruc,1) aNewStruc[ix,1]='T'+padl(ix-lnTimeColStart,3,'0') aNewStruc[ix,2]='I' ENDFOR CREATE cursor myCursor from array aNewStruc FOR ix=1 to 2 APPEND blank SCATTER to aSetTimes FOR jx = lnTimeColStart to lnTimeColStart + 3 aSetTimes[jx] = 1 ENDFOR GATHER from aSetTimes ENDFOR lcPattx = '' FOR ix = 1 to 186 lcPattx = lcPattx + ; ',sum(T'+padl(ix-1,3,'0')+')' ENDFOR *** * Next crash *** SELECT f1,f2 &lcPattx ; FROM myCursor ; group by 1, 2 ; into cursor myCursor1 ; nofilterI seek a way to do by SQL.
lcPattx = '' >>for ix = 1 to 186 >> lcPattX = lcPattx + ; >> ',sum(T'+padl(ix-1,3,'0')+') as T'+padl(ix-1,3,'0') >>endfor >>select f1,f2,f3 &lcPattX from ...Then this :
lcPattx = '' >>for ix = 1 to 186 >> lcPattX = lcPattx + ; >> 'sum(T'+padl(ix-1,3,'0')+') as T'+padl(ix-1,3,'0')+', ;'+chr(13) >>endfor >>_cliptext = lcPattXand pasted the code. I even tried removing 'as ...' part. Total commandline length is 4199 at max. Both approaches crash VFP. Any ideas other than not using SQL ? TIA