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

don't work on updates


2010/1/14 mdipierro <[email protected]>

> 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 <[email protected]>
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<web2py%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>
>
>


-- 
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 [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

Reply via email to