db.define_table('Account_Master',Field('Account',requires=IS_NOT_EMPTY()),Field('Sewadari1'),Field('Mb1'),Field('Sewadari2'),Field('Mb2'),Field('City'),Field('District'),Field('State'),Field('Email'),Field('Remark'),format='%(Account)s %(State)s ')
db.define_table('Transaction_Master',Field('Account',db.Account_Master,requires=IS_IN_DB(db,'Account_Master.id', '%(Account)s %(State)s',zero=T('choose one'))),Field('Exam_Date','date'),Field('Entry_Date','date',default=request.now),Field('Form_1','upload'),Field('Form_1_Name'),Field('Schoolwise_Form','upload'),Field('Schoolwise_Form_Name'),format='%(Account)s %(Exam_Date)s')
When i try to represent the account field of Transaction_Master table in sqlform.factory as:
form=SQLFORM.factory(Field('TID',requires=IS_IN_DB(db,db.Transaction_Master.id,'%(Account)s %(Exam_Date)s %(id)s')))
I am getting the id field of account in the sqlform.factory form. Is there a way so that i may get the account name which that id field refers to in the account master?
IS_IN_DB(db, db.Transaction_Master.id,
lambda r: '%s %s %s' % (db.Account_Master[r.Account].Account, r.Exam_Date, r.id))
Here is the line which was found erroraneous(in pink):
def viewreport():
form=SQLFORM.factory(Field('TID',requires=IS_IN_DB(db, db.Transaction_Master.id,
lambda r: '%s %s %s' % (db.Account_Master[r.Account].Account, r.Exam_Date, r.id))
))
With Regards,Thanks Anthony!
I did as u said but now i get the following error:<type 'exceptions.AttributeError'> 'NoneType' object has no attribute 'Account'
Here is the line which was found erroraneous(in pink):
With Regards,def viewreport():
form=SQLFORM.factory(Field('TID',requires=IS_IN_DB(db, db.Transaction_Master.id,lambda r: '%s %s %s' % (db.Account_Master[r.Account].Account, r.Exam_Date, r.id))
))
rahulserver.
IS_IN_DB(db, db.Transaction_Master.id,
lambda r: '%s %s %s' % \
(db.Account_Master[r.Account].Account if db.Account_Master[r.Account] else '',
r.Exam_Date, r.id))