05-11-2011, 02:39 PM
I tried a code like this:
Macro Macro5
but many querys and takes time.
Is possible to use something like this: http://stackoverflow.com/questions/3946 ... en-2-dates to speed up the code?
Macro Macro5
str start_date("01/05/11") end_date("31/12/11") temp_date
temp_date=start_date
ExcelSheet es.Init("" 8|16)
Database db2.Open(db2.CsExcel(artemp))
ARRAY(str) a1
DATE d=start_date
int row=1
for r 0 a.len
,rep
,,q1.format("SELECT SUM(b) FROM [test$] WHERE DateValue(c)=#%s# AND a='%s'" temp_date a[r])
,,db2.QueryArr(q1 a1 1)
,,str x=a1
,,es.SetCell(x 1+r row)
,,d=d+1
,,temp_date=d
,,if(temp_date=end_date)
,,,row+1
,,,break
but many querys and takes time.
Is possible to use something like this: http://stackoverflow.com/questions/3946 ... en-2-dates to speed up the code?