I would think you would get an error since both price and pricecoefficient appear to be strings rather than numeric types (also, pricecoefficient is misspelled in the table definition).
Anthony On Tuesday, August 27, 2013 1:37:51 PM UTC-7, greenpoise wrote: > > I get NONE. I have these: > > db.define_table('supplier', > Field('suppliercode'), > Field('suppliername'), > Field('pricecoeficient'), > format='%(suppliercode)s') > > db.define_table('product', > Field('series', 'reference series'), > Field('suppliercode','reference supplier'), > Field('price'), > Field('cost',compute=lambda r: r['price']*db.supplier[r.supplier_id]. > pricecoefficient)) > > and I am using SQLFORM.grid which automatically assigns a supplier to the > record. I assumed it would pick up the pricecoefficient and do the > calculation but I think I am missing something. > > > > > > > > On Tuesday, August 27, 2013 1:13:58 PM UTC-7, Massimo Di Pierro wrote: >> >> I do not know the model but looks plausible. does it not work? >> >> On Tuesday, 27 August 2013 13:02:08 UTC-5, greenpoise wrote: >>> >>> Is this correct? >>> >>> Field('cost',compute=lambda r: r['price']*db.supplier[r.supplier_id]. >>> pricecoefficient) >>> >>> >>> -- --- 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/groups/opt_out.