Hi,
I have the following model definitions:
db.define_table('bl_nationality',
Field('nationality', 'string')
)
db.define_table('bl_names',
Field('surname', 'string'),
Field('forename', 'string'),
Field('dob', 'date', requires=IS_DATE(format=T(''%Y-%m-%d'))),
Field('nationality', db.bl_nationality),
)
I'm trying to build a custom search form, which searches a database for
various values *depending upon what fields are filled.*
Now, I can build a dict of fields corresponding to *only* the filled-in
fields in the search form & parse that into a separate list of
db.bl_names.surname.contains(request.vars['surname']) type-objects.
My question is how do I combine all these separate objects into one
meta-query (as it were)?
I was trying something like this, but it doesn't seem to work:
###########
rows=db(my_sets[0])
for my_set in my_sets[1:]:
rows=db( rows & my_set)
return dict(rows=rows)
One of the more illuminating errors was (errinfo=(1064, u'42000', u"You have
an error in your SQL syntax; check th...'<gluon.dal.Set object at
0x03FBEB70>' at line 1"))
Any assistance or suggestions would be appreciated.
Martin