I am currently getting the error below: 
*<class 'sqlite3.OperationalError'> no such column: fuelLogging.ODO_Reading*
The problem is where i Highlighted 
def fuelLogging_before_update(*args, **kwargs):
        db.fuelLogging.Delta.compute = lambda r: *(db.fuelLogging.ODO_Reading 
* -1)* + r.ODO_Reading
        
db.define_table('fuelLogging',
    Field('ODO_Reading', 'integer'),
    Field('Delta', 'integer', default=0))
db.fuelLogging._before_update.append(fuelLogging_before_update())


I still have a hardtime getting results


On Friday, January 18, 2019 at 8:43:36 AM UTC+2, mostwanted wrote:
>
>  Hey Anthony, my delta value still returns 0, its set default value, 
>
> *MODEL*
> def fuelLogging_before_update(*args, **kwargs):
>     db.fuelLogging.compute = lambda r: (db.fuelLogging.ODO_Reading * -1) + 
> r.ODO_Reading
>
> db.define_table('fuelLogging',
>     Field('ODO_Reading', 'integer'),
>     Field('Delta', 'integer', default=0))
> db.fuelLogging._before_update.append(fuelLogging_before_update)
>
> but let me ask this, isn't the formula for our fuelLogging_before_update() 
> function supposed to be:
> *db.fuelLogging.Delta.compute = lambda r: (db.fuelLogging.ODO_Reading * 
> -1) + r.ODO_Reading*
> considering that we are trying to make updates to the *Delta *value?? 
> Just wondering!
>
> I want to believe my controller must be straight forward with NO special 
> formulas
> *CONTROLLER*
> def viewLog():
>     details=db(db.fuelLogging).select(db.fuelLogging.ALL)
>     return locals()
>
> *VIEW*
> {{extend 'layout.html'}}
>
> {{for details in details:}}
>
> ODO Reading: {{=details.ODO_Reading}}<br />
> Delta: {{=details.Delta}}<br />
> {{pass}}
>
>
> Nonetheless my delta value is still being returned as 0 
>
> I wanted to show my whole code in-case i am missing something somewhere, 
> its my first time using *callbacks on records*, i am not at all familiar 
> with them!
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to