Thank you,
I'll probably do the math in my app, because I'd like to be able to
perform a search on the result (impossible with virtual fields, am I
right?).

However, I think the text in the book is misleading :
"[...]if a value for the field is not provided, web2py tries to
compute from the other field values using the compute function."
Reading this, I understand that:
If a value is provided, then the compute attribute is ignored.


On 1 sep, 20:36, pbreit <pbreitenb...@gmail.com> wrote:
> Computed fields can't be edited because they are computed.
>
> Maybe just set a default:
> db.article.price_with_taxes.default = lambda r: r.price*(1+r.taxes)/100)
>
> I would typically not advise creating a field in the database that is simply
> a computation of another field. I would probably use a Virtual Field [1] or
> just do the math in my application.
>
> [1]http://web2py.com/book/default/chapter/06#Virtual-Fields

Reply via email to