> > Virtual field shows up OK in the "table" view, but : >
> 1. It does not appear at all when I click on "View" button > By default, virtual fields don't show up in readonly forms, but you can list them in the "fields" argument. To pass the "fields" argument to the view form when using the grid, you can use the "viewargs" argument. Maybe something like: grid = SQLFORM.grid(db.mytable, viewargs={'fields': [f for f in db.mytable.__dict__ if isinstance(db.mytable[f], (Field , Field.Virtual))]}, ...) We should probably add an argument to SQLFORM to automatically include virtual fields in readonly forms. > 2. are not used for "default" search > This would be difficult, as it would require selecting *all* the records from the database, calculating the virtual fields for all records, and then searching the Rows object using Python. Currently the search functionality works by issuing a query to the database (i.e., the database does the searching and returns only the matching records), and because the virtual fields are not stored in the database, it is not possible for search to be based on them. If this is important, you might consider using a computed field instead. Anthony -- 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.