[web2py] Re: Virtual Fields and Smartgrid not working as expected

2014-03-25 Thread Carlos Alba
Hello,

I am working with *2.9.5-stable+timestamp.2014.03.16.02.35.39*
and getting  

 Query Not Supported: 'str' object is not callable 

message
I wonder if this issue is fixed or I am missing something.

BTW, I am just starting my web2py process. King regards to all web2py 
community.

On Thursday, September 19, 2013 3:49:35 AM UTC-5, hiro wrote:

 In the book I read:

 *Showing virtual fields in SQLFORM.grid and smartgrid*
 In recent versions of web2py, virtual fields are shown in grids like 
 normal fields: either shown alongside all other fields by default, or by 
 including them in the fields argument. However, virtual fields are not 
 sortable.

 However, if i use the welcome app and define:

 db.define_table('entity',
 Field('entity_name', 'string'),
 Field('slogan', 'string'),
 Field.Virtual('slogan2', lambda row: row.entity.slogan+', it is 
 really the best.')
 )

 and then create a grid:

 def index():
 my_grid = SQLFORM.grid(db.entity)
 return locals()

 Reading the book I expect this to work. However I get the error 'Query 
 Not Supported: no such column: entity.slogan2' in the smartgrid.

 Massimo, is this related to to the same bug I asked about yesterday? (I 
 have not yet updated my web2py to trunk, but did not find anything about 
 this issue in the tracker.)

 One solution might be to change the Virtual Fiels to computed fields.

 A big hug to all web2py contributors!

 Edit: Using stable version of 2.6.4


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Virtual Fields and Smartgrid not working as expected

2013-10-04 Thread Tim Richardson
I've been trying to debug this but the learning curve is steep. If you 
generate a query like so:

db.person.full_name = Field.Virtual('full_name',lambda row: 999)
qry = db.person
set = db(qry)
res = set.select()

then the virtual field is not included in the SQL sent to the database. 
parse in dal.py adds it after the database query.
The grid code adds the field to the list of columns and fields, which means 
it ends up in the SQL sent to the database, results in a database error 
(since the field is not really in the table) 
I'm not sure if there is a post-query scan for virtual fields in the grid, 
at least I couldn't find it. 



On Saturday, 28 September 2013 04:40:49 UTC+10, hiro wrote:

 Thank you!

 On Friday, September 27, 2013 8:14:55 PM UTC+2, Massimo Di Pierro wrote:

 I can confirm the problem and I opened a ticket:

 https://code.google.com/p/web2py/issues/detail?id=1692

 On Thursday, 19 September 2013 03:49:35 UTC-5, hiro wrote:

 In the book I read:

 *Showing virtual fields in SQLFORM.grid and smartgrid*
 In recent versions of web2py, virtual fields are shown in grids like 
 normal fields: either shown alongside all other fields by default, or by 
 including them in the fields argument. However, virtual fields are not 
 sortable.

 However, if i use the welcome app and define:

 db.define_table('entity',
 Field('entity_name', 'string'),
 Field('slogan', 'string'),
 Field.Virtual('slogan2', lambda row: row.entity.slogan+', it is 
 really the best.')
 )

 and then create a grid:

 def index():
 my_grid = SQLFORM.grid(db.entity)
 return locals()

 Reading the book I expect this to work. However I get the error 'Query 
 Not Supported: no such column: entity.slogan2' in the smartgrid.

 Massimo, is this related to to the same bug I asked about yesterday? (I 
 have not yet updated my web2py to trunk, but did not find anything about 
 this issue in the tracker.)

 One solution might be to change the Virtual Fiels to computed fields.

 A big hug to all web2py contributors!

 Edit: Using stable version of 2.6.4



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Virtual Fields and Smartgrid not working as expected

2013-09-27 Thread hiro
Small bump, this error is still present in latest stable version.

On Thursday, September 19, 2013 10:49:35 AM UTC+2, hiro wrote:

 In the book I read:

 *Showing virtual fields in SQLFORM.grid and smartgrid*
 In recent versions of web2py, virtual fields are shown in grids like 
 normal fields: either shown alongside all other fields by default, or by 
 including them in the fields argument. However, virtual fields are not 
 sortable.

 However, if i use the welcome app and define:

 db.define_table('entity',
 Field('entity_name', 'string'),
 Field('slogan', 'string'),
 Field.Virtual('slogan2', lambda row: row.entity.slogan+', it is 
 really the best.')
 )

 and then create a grid:

 def index():
 my_grid = SQLFORM.grid(db.entity)
 return locals()

 Reading the book I expect this to work. However I get the error 'Query 
 Not Supported: no such column: entity.slogan2' in the smartgrid.

 Massimo, is this related to to the same bug I asked about yesterday? (I 
 have not yet updated my web2py to trunk, but did not find anything about 
 this issue in the tracker.)

 One solution might be to change the Virtual Fiels to computed fields.

 A big hug to all web2py contributors!


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Virtual Fields and Smartgrid not working as expected

2013-09-27 Thread Mirko
Hi,
I confirm this error here with 2.5.1
Ciao ciao
Mirko

On Thursday, September 19, 2013 10:49:35 AM UTC+2, hiro wrote:

 In the book I read:

 *Showing virtual fields in SQLFORM.grid and smartgrid*
 In recent versions of web2py, virtual fields are shown in grids like 
 normal fields: either shown alongside all other fields by default, or by 
 including them in the fields argument. However, virtual fields are not 
 sortable.

 However, if i use the welcome app and define:

 db.define_table('entity',
 Field('entity_name', 'string'),
 Field('slogan', 'string'),
 Field.Virtual('slogan2', lambda row: row.entity.slogan+', it is 
 really the best.')
 )

 and then create a grid:

 def index():
 my_grid = SQLFORM.grid(db.entity)
 return locals()

 Reading the book I expect this to work. However I get the error 'Query 
 Not Supported: no such column: entity.slogan2' in the smartgrid.

 Massimo, is this related to to the same bug I asked about yesterday? (I 
 have not yet updated my web2py to trunk, but did not find anything about 
 this issue in the tracker.)

 One solution might be to change the Virtual Fiels to computed fields.

 A big hug to all web2py contributors!


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Virtual Fields and Smartgrid not working as expected

2013-09-27 Thread Massimo Di Pierro
I can confirm the problem and I opened a ticket:

https://code.google.com/p/web2py/issues/detail?id=1692

On Thursday, 19 September 2013 03:49:35 UTC-5, hiro wrote:

 In the book I read:

 *Showing virtual fields in SQLFORM.grid and smartgrid*
 In recent versions of web2py, virtual fields are shown in grids like 
 normal fields: either shown alongside all other fields by default, or by 
 including them in the fields argument. However, virtual fields are not 
 sortable.

 However, if i use the welcome app and define:

 db.define_table('entity',
 Field('entity_name', 'string'),
 Field('slogan', 'string'),
 Field.Virtual('slogan2', lambda row: row.entity.slogan+', it is 
 really the best.')
 )

 and then create a grid:

 def index():
 my_grid = SQLFORM.grid(db.entity)
 return locals()

 Reading the book I expect this to work. However I get the error 'Query 
 Not Supported: no such column: entity.slogan2' in the smartgrid.

 Massimo, is this related to to the same bug I asked about yesterday? (I 
 have not yet updated my web2py to trunk, but did not find anything about 
 this issue in the tracker.)

 One solution might be to change the Virtual Fiels to computed fields.

 A big hug to all web2py contributors!

 Edit: Using stable version of 2.6.4


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Virtual Fields and Smartgrid not working as expected

2013-09-27 Thread hiro
Thank you!

On Friday, September 27, 2013 8:14:55 PM UTC+2, Massimo Di Pierro wrote:

 I can confirm the problem and I opened a ticket:

 https://code.google.com/p/web2py/issues/detail?id=1692

 On Thursday, 19 September 2013 03:49:35 UTC-5, hiro wrote:

 In the book I read:

 *Showing virtual fields in SQLFORM.grid and smartgrid*
 In recent versions of web2py, virtual fields are shown in grids like 
 normal fields: either shown alongside all other fields by default, or by 
 including them in the fields argument. However, virtual fields are not 
 sortable.

 However, if i use the welcome app and define:

 db.define_table('entity',
 Field('entity_name', 'string'),
 Field('slogan', 'string'),
 Field.Virtual('slogan2', lambda row: row.entity.slogan+', it is 
 really the best.')
 )

 and then create a grid:

 def index():
 my_grid = SQLFORM.grid(db.entity)
 return locals()

 Reading the book I expect this to work. However I get the error 'Query 
 Not Supported: no such column: entity.slogan2' in the smartgrid.

 Massimo, is this related to to the same bug I asked about yesterday? (I 
 have not yet updated my web2py to trunk, but did not find anything about 
 this issue in the tracker.)

 One solution might be to change the Virtual Fiels to computed fields.

 A big hug to all web2py contributors!

 Edit: Using stable version of 2.6.4



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.