This helped me a lot. I included these defaults in web2py so that you 
should need to do it yourself. Can you please check if 

db.test.c12 = Field.Virtual (lambda r: r.t1+r.t2)

now works as expected?

On Tuesday, 26 February 2013 05:28:59 UTC-6, Donatas Burba wrote:
>
> I have a workaround for this issue. Just a little helper function in 
> modules:
>
> def virtual_field(db, table_name, field_name, field_type, compute=lambda 
> row: None, label='', represent=None):
>     db[table_name][field_name] = Field.Virtual(compute)
>     db[table_name][field_name].type = field_type
>     db[table_name][field_name].label = label
>     db[table_name][field_name].represent = represent
>     db[table_name][field_name].formatter = lambda value: value
>     db[table_name][field_name].comment = None
>     db[table_name][field_name].readable = True
>     db[table_name][field_name].writable = False
>     db[table_name][field_name].requires = None
>     db[table_name][field_name].widget = None
>     db[table_name][field_name].name = field_name
>     db[table_name][field_name].tablename = table_name
>     db[table_name][field_name].filter_out = None
>
> Because I very often need such virtual fields (to show complex computed 
> result from several fields or even tables), this really helps me.
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to