Hi there,
            I am building an app to store electrical consumption data . I 
have build a database which include three tabled dept,meter and reading. 
THe problem that i have encountered is with the syntax in the following 
code:



def reg_meter():
    form = SQLFORM.factory(
    Field('meter_num',requires=IS_IN_DB(db,db.meter)),
    Field('meter_type',requires=IS_IN_DB(db,db.meter)),
    
Field('dept_id',requires=IS_IN_DB(db,db.dept.id,'%(dept_id)s')).process()
    if form.accepted:
        entered = db((db.entered.meter_num == form.vars.meter_num) & 
(db.entered.meter_type == form.vars.meter_type) & (db.entered.dept_id == 
form.vars.dept_id)).select().first()
    
       if entered:
          entered.update_record((meter_num = 
entered.meter_num+form.vars.meter_num) & (meter_type = 
entered.meter_type+form.vars.meter_type) & (dept_id = 
entered.dept_id+form.vars.dept_id)

       else:
           
db.entered.insert(meter_num=form.vars.meter_num,meter_type=form.vars.meter_type,
dept_id=form.vars.dept_id)    

            response.flash = 'new record inserted'
    elif form.errors:
    response.flash = 'invalid values in form'

    records = 
SQLTABLE(db().select(db.meter.ALL),headers='fieldname:capitalize')
    return dict(form=form, records=records)



It is a function in the default.py for inserting the values. The error is a 
syntax error which im not able to debug. Kindly guide me thru the issue. 
the syntax error is at the line ' if form.accepted:'  May be the error is 
at some other line which i cant find out.

Thanks !
kartik

-- 
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/groups/opt_out.

Reply via email to