Re: [web2py] Re: web2py dal week query

2014-03-14 Thread 黄祥
a, i c, thank you so much for your hints, michele. best regards, stifan On Friday, March 14, 2014 6:41:11 AM UTC+7, Michele Comitini wrote: > > From postgresql manual: > > http://www.postgresql.org/docs/current/static/functions-datetime.html > > > SELECT EXTRACT(WEEK FROM TIMESTAMP '2001-02-16

Re: [web2py] Re: web2py dal week query

2014-03-13 Thread Michele Comitini
>From postgresql manual: http://www.postgresql.org/docs/current/static/functions-datetime.html SELECT EXTRACT(WEEK FROM TIMESTAMP '2001-02-16 20:38:40'); Not supported by DAL expressions, but you can use executesql... 2014-03-14 0:26 GMT+01:00 黄祥 : > actually i wan to create a chart from that

Re: [web2py] Re: web2py dal week query

2014-03-13 Thread 黄祥
actually i wan to create a chart from that query : e.g. for year and month is work this way *views/default/index.html* {{sum_sale_order = db.sale_order_header.total.sum() }} {{query_yearly_sale_order = (db.sale_order_header.sale_order_date.year() == request.now.year) }} {{sum_yearly_sale_order =

Re: [web2py] Re: web2py dal week query

2014-03-13 Thread Richard Vézina
db.table(1).field.isocalendar()[1] will works because you have a record selected... But you don't have access to any field value in context of where clause db(** where clause **).select() Richard On Thu, Mar 13, 2014 at 2:17 PM, Richard Vézina wrote: > I see you want to make a query but why y

Re: [web2py] Re: web2py dal week query

2014-03-13 Thread Richard Vézina
I see you want to make a query but why you want to make that? Also, more experienced user correct me if I am wrong, but personnally I never had good result doing what you are doing, I mean I don't remember having it working correctly (even in SQL)... In : (db.sale_order_header.sale_order_date.iso

Re: [web2py] Re: web2py dal week query

2014-03-13 Thread 黄祥
yes, already tried but got an error traceback. what i want to achieve is something like example below, but when i've tested it, i got an error traceback. any idea how to achieve it in web2py? e.g. import datetime (db.sale_order_header.sale_order_date.strftime("%U") == request.now.strftime("%U")

Re: [web2py] Re: web2py dal week query

2014-03-13 Thread Richard Vézina
Did you try what suggested in the ref you post? If it works with datetime it should work with web2py date, since it a datetime object... But maybe you want something else like Python Calendar... Hard to say with knowing what you want to do... Richard On Thu, Mar 13, 2014 at 1:14 PM, 黄祥 wrote:

[web2py] Re: web2py dal week query

2014-03-13 Thread 黄祥
pardon, not sure what do you mean with all Tuesdays. what i want to achieve is to get week number, something like in python : isocalendar() strftime("%U") ref: http://stackoverflow.com/questions/2600775/how-to-get-week-number-in-python how to achieve it using web2py method? thanks and best rega

[web2py] Re: web2py dal week query

2014-03-13 Thread Massimo Di Pierro
No because the database engines do not support week(..). Are you looking for something like all Tuesdays? On Thursday, 13 March 2014 11:16:49 UTC-5, 黄祥 wrote: > > hi, > > i'm interest in web2py dal query about year, month, day, hour, minutes, > seconds > but i can't see for week query. is it pos