[web2py] Re: group by weeks

2010-05-13 Thread mdipierro
the dal has no weekday function but datetime.date does. That means if
you select the records by some time range we you can maniputale them
at the Python/web2py level. How really depends on details. You could
also create a function that uses datetime weekday to build query
ranges for dal.

On May 13, 11:10 am, greenpoise danel.sega...@gmail.com wrote:
 Is there such thing? i need to group a result set by weeks. Sort of
 like total sales of the week. How could I accomplish this? I really
 dont want the user to be entering a range of dates. The weeks will
 always start on Monday and finish on Sunday. My table takes daily
 sales.

 Thanks


[web2py] Re: group by weeks

2010-05-13 Thread greenpoise
I see. So there has to be some time range. Python has a calendar
module, I thought perhaps putting all the weeks on a table? Will keep
diggin. Thanks

Dan



On May 13, 12:15 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 the dal has no weekday function but datetime.date does. That means if
 you select the records by some time range we you can maniputale them
 at the Python/web2py level. How really depends on details. You could
 also create a function that uses datetime weekday to build query
 ranges for dal.

 On May 13, 11:10 am, greenpoise danel.sega...@gmail.com wrote:

  Is there such thing? i need to group a result set by weeks. Sort of
  like total sales of the week. How could I accomplish this? I really
  dont want the user to be entering a range of dates. The weeks will
  always start on Monday and finish on Sunday. My table takes daily
  sales.

  Thanks


Re: [web2py] Re: group by weeks

2010-05-13 Thread Vasile Ermicioi
this is working

db(db.orders.id  0).select(count(1) as nr, round(id/10) as gr,
groupby='gr')

so I think you can use database datetime function to compute week and then
grouping,
most database have such functions


[web2py] Re: group by weeks

2010-05-13 Thread greenpoise
will try. Thanks





On May 13, 1:50 pm, Vasile Ermicioi elff...@gmail.com wrote:
 this is working

 db(db.orders.id  0).select(count(1) as nr, round(id/10) as gr,
 groupby='gr')

 so I think you can use database datetime function to compute week and then
 grouping,
 most database have such functions