I am trying to calculate the number of days and use that value in another
calculation in my database.
I used this method below which used to to work perfectly but todays its
giving me an error
db.define_table('invoice',
Field('loaning_date', 'date', label=SPAN('Date Loaned',
_style="font-weight: bold;"), requires=IS_NOT_EMPTY()),
Field('returning_date', 'date', label=SPAN('Date Returned',
_style="font-weight: bold;"), requires=IS_NOT_EMPTY()),
* #Number of days calculation*
*Field('daysLoaned', compute=lambda r:
(r['returning_date']-r['loaning_date']).days),*
Field('price', 'float', label=SPAN('Price',
_style="font-weight:
bold;"), requires=IS_MATCH('[0-9]+', error_message=T('Enter Money in Proper
Figures'))),
Field('totalPrice', compute=lambda r: float(r['price'])* int
(r['daysLoaned']), label=SPAN('Total Price', _style="font-weight: bold;")))
Why am i getting this error? How do i rectify it, maybe i am missing
something!
Regards;
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/81258c48-5f9a-435a-9107-e3a75d4569eb%40googlegroups.com.