[web2py] Does python IN operator works for DAL?

2014-07-02 Thread Pham Quang Dung
Hi, Below are the DAL query and its SQLite version, the bold expression was always 1 (true) which made me think its not working? recs = db(m.mt_account==184901310)(*m.name[:2] in ['cr','bu','se']*)(m.writetime lastupdate)(m.name[-4:]=='LOTs').select(

[web2py] Re: with_alias unexpectedly converts field type to string

2014-07-02 Thread Pham Quang Dung
Thanks Massimo, Yes I changed the field type so I know why now. On Monday, June 30, 2014 11:44:28 AM UTC+7, Pham Quang Dung wrote: Can anyone explain to me what I did wrongly to have the unexpected string test field, instead of double? x=db().select(tb.searchvalue.with_alias('test')) x[0

[web2py] with_alias unexpectedly converts field type to string

2014-06-30 Thread Pham Quang Dung
Can anyone explain to me what I did wrongly to have the unexpected string test field, instead of double? x=db().select(tb.searchvalue.with_alias('test')) x[0] Row {'test': u'3', '_extra': {'tb.searchvalue AS test': 3.0}} -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Reference a field by number rather than name

2014-06-28 Thread Pham Quang Dung
I wonder if there's a way we can use [1] like in row[r][1] instead of row[r].fieldname? sometimes I must use this form of select which doesnot allow aliases db(x).select('afield as f') -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

[web2py] Re: DAL and Cast operator

2014-06-21 Thread Pham Quang Dung
(tb.tab.stringfield + db.tab.string2_field) On Friday, June 20, 2014 5:25:19 AM UTC+7, Massimo Di Pierro wrote: an you explain what you are trying to achieve? I am not sure from the example. On Tuesday, 17 June 2014 01:29:11 UTC-5, Pham Quang Dung wrote: I am using SQLite and it appears

[web2py] Re: Smartgrid onupdate still works while set to None

2014-06-19 Thread Pham Quang Dung
You are right Anthony, understood now. Thanks Massimo for the warning as well. On Saturday, May 31, 2014 8:07:33 PM UTC+7, Anthony wrote: On Friday, May 30, 2014 7:59:01 PM UTC-4, Pham Quang Dung wrote: Anybody enlighten me on while this form still updates the data? (I expected

[web2py] DAL and Cast operator

2014-06-19 Thread Pham Quang Dung
I am using SQLite and it appears no casting is available (or required?). But I cannot perform a command like this: db().select('test'+ db.tab.int_account) can you show me the right syntax to make it happen? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: onvalidation in sqlform.smartgrid for delete purpose

2014-05-31 Thread Pham Quang Dung
Niphlod, where may we find the default call back? e.g for onvalidation? thanks On Thursday, September 19, 2013 5:32:40 AM UTC+7, Niphlod wrote: use always the same method. add a few logging lines between those lines of code and see for yourself why your code isn't executed On Wednesday,

[web2py] Re: DAL doesn't fully support datetime operations

2014-05-31 Thread Pham Quang Dung
(db.mytable).select(minus_5_min).first() print row[minus_5_min] Anthony On Thursday, May 29, 2014 11:49:06 PM UTC-4, Pham Quang Dung wrote: Hm, Not true, I forgot to say I did with execlsql OK, for Sqlite, select DATETIME((writetime), -5 minutes) from xxx On Friday, May 30, 2014 2:35:42 AM

[web2py] Re: import right here?

2014-05-31 Thread Pham Quang Dung
posting. from here onwards there is the documentation about third-party modules and the execution environment of web2py. http://web2py.com/books/default/chapter/29/04/the-core#Third-party-modules On Thursday, May 29, 2014 12:40:43 PM UTC+2, Pham Quang Dung wrote: I have placed an __init__.py

[web2py] Smartgrid onupdate still works while set to None

2014-05-31 Thread Pham Quang Dung
Anybody enlighten me on while this form still updates the data? (I expected it was disabled to then use my own callback) form = SQLFORM.smartgrid(db.anyinfo,onupdate=None ,constraints = dict(anyinfo = (tb.name[6:]=='level'))

[web2py] Re: DAL doesn't fully support datetime operations

2014-05-30 Thread Pham Quang Dung
the result AFTER fetching the rows from the db. On Thursday, May 29, 2014 12:32:41 PM UTC+2, Pham Quang Dung wrote: I tried a query like *db().select(xx.writetime - timedelta(minutes=5)) *and the result was totally a surprise because it was of type Int. Thoughts? -- Resources: - http

[web2py] import right here?

2014-05-29 Thread Pham Quang Dung
I have placed an __init__.py file in the folder (windows) of the controller xyz.py but cannot import abc.py at the same location. Any hints to use path + file name, or copy the abc.py to where? I am newbee, sorry. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] a simple naive question about the Submit button?

2014-05-29 Thread Pham Quang Dung
Appreciate a simple hint if possible but I spent hours and could not trace anywhere in the code where I could see how to modify the way SQLForm.smartgrid takes a DB actions, such as save or delete. The ultimate purpose is to customize the grid so that I donot need to click View/Edit/Delete per

[web2py] DAL doesn't fully support datetime operations

2014-05-29 Thread Pham Quang Dung
I tried a query like *db().select(xx.writetime - timedelta(minutes=5)) *and the result was totally a surprise because it was of type Int. Thoughts? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -