A quick solution would be organization=db((db.organization.cocNumber==form.vars.cocNumber)&\ (db.organization.subdossierNumber==form.vars.subdossierNumber)).select(db.organization.ALL,cache=(cache.ram,3600))
On Tuesday, 9 October 2012 11:44:54 UTC-5, Annet wrote: > > In a function I have the following code: > > form=SQLFORM.factory(...) > if form.process(keepvalues=True).accepted: > organization=db((db.organization.cocNumber==form.vars.cocNumber)&\ > > (db.organization.subdossierNumber==form.vars.subdossierNumber)).select(db.organization.ALL) > if organization: > response.flash='The database already contains an organization with > this coc_number and subdossier_number' > else: > processForm(form) > elif form.errors: > response.flash=responseFlash('formerror',session) > elif not response.flash: > response.flash=responseFlash('form',session) > return dict(form=form) > > The problem is that some organizations do have the same coc_number and > subdossier_number but differ in name and address, so after the warning > flash I'd like to be able to submit the form again and just call > processForm(form) so without checking whether the database contains the > organization or not. > > What is the best way to code this? > > > Kind regards, > > Annet. > > --