You can't access valor_do_dolar from custo_em_real lambda computed since it is a computed field that get computed un submit... If you want to do that you will have to make a real function that get process on submit with form.process().accepted and the argument onsuccess or onvalidation
See chapter 7 with both keyword here a link for the first keyword : http://web2py.com/books/default/chapter/29/7?search=onsuccess Richard On Wed, Feb 29, 2012 at 3:51 PM, Tito Garrido <titogarr...@gmail.com> wrote: > Hi Folks, > > I am trying a simple example using sqlite: > > db.define_table('compra_produto', > Field('compra', 'reference compra'), > Field('produto','reference produto'), > Field('quantidade','integer'), > Field('custo_em_dolar','double'), > Field('cotacao_do_dolar','double'), > Field('custo_em_real', compute=lambda cr: > cr['custo_em_dolar']*cr['valor_do_dolar']), > Field('valor_total', compute=lambda vt: > vt['custo_em_real']*vt['quantidade']) > > But both computed fields are always set as "None"... I am trying it from > administrative database screen... > > Am I doing anything wrong? > > -- > > Linux User #387870 > .........____ > .... _/_õ|__| > ..º[ .-.___.-._| . . . . > .__( o)__( o).:_______ >