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.

Reply via email to