lcFields="" for lnweek=1 to 6 for lndow=1 to 7 lcFields=lcFields+iif(empty(lcFields),"",", ")+; "Data_"+str(lnweek,1)+"_"+str(lndow,1)+" M" endfor endfor create cursor MonthData (&lcFields) append blankThen I'd select my data for the month (let's say March)...
ldMthStart={^2001/3/1} ldMthEnd={^2001/3/31} SELECT ; WEEK(tabledate)-WEEK(ldMthStart)+1 as weekindex,; DOW(tabledate) as dowindex,; tabletext ; FROM ; mytable ; WHERE ; tabledate BETWEEN ldMthStart AND ldMthEnd ; INTO ; CURSOR mycursorThen SCAN thru this cursor, updating the appropriate field in MonthData (i.e. DATA_"+str(weekindex,1)+"_"+str(dowindex,1)).