How can achieve decremental subtraction of a value in a database field?
*MODEL CODE*
db.define_table('fuelLogging',
Field('Quantity', 'integer', requires=IS_NOT_EMPTY()),
Field('Rate', 'integer', requires=IS_NOT_EMPTY()),
Field('Total', compute=lambda r:r['Quantity']*r['Rate']),
Field('ODO_Reading', 'integer', requires=IS_NOT_EMPTY()),
* Field('Delta', compute=lambda
r:r['ODO_Reading']-r['ODO_Reading'], requires=IS_NOT_EMPTY()),*
Field('Fuel_Usage', compute=lambda r: r['Delta']/r[
'Quantity']))
To get the delta field i have to subtract the previously entered
ODO_Reading value from the newly entered ODO_Reading value but what i have
done here is not working, any suggestions?
Mostwanted
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.