with 1.74.5 and later you only need

db.order_detail.total.compute=lambda r: r['qtd']*r['price']

On Jan 14, 8:51 am, Alexandre Andrade <alexandrema...@gmail.com>
wrote:
> What is the best solution to automatically calculate a total field?
>
> db.define_table ('order_detail',
>               Field('product_name'),
>               Field('qtd', 'integer'),
>               Field('price', 'integer'),
>               Field('total', 'integer', writable=False)
> )
>
> Where  total = qtd * price
>
> requires and a custom validator? how to do?
> onvalidation on form? how to do?
>
> --
> Atenciosamente
>
> --
> =========================
> Alexandre Andrade
> Hipercenter.com
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to