El 25/02/17 a las 08:43, Anthony escribió:
It appears the linked Yii example is not fully generalizable -- it
works for a virtual field that merely concatenates other fields
because you can define searching and sorting queries for it that can
be handled by the database. I don't think it would work with arbitrary
Python expressions, many of which would not be able to be executed by
the database in order to handle searching and sorting on the generated
values.
In general, I'm not sure it makes sense for web2py virtual fields to
be searchable and sortable because in order to work for all possible
virtual field functions, the searching/sorting would have to be done
in Python after selecting/all/ records from the table (which may not
be practical at all for large tables).
I agree, is not fully generalizable, but solves a good range of situations.
Instead, it would probably make sense to implement a more limited
functionality that allows adding SQL expressions as additional
columns, as discussed here: https://github.com/web2py/web2py/issues/1553.
I like it, some kind of Field.Expression() will be very helpful.
Thanks again for your help.
Greetings.
--
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.