s='select p.id,partno,description, c.name || l.name as location_descriptor from parts as p inner join locations as l on p.location_id = l.id inner join containers as c on l.container_id = c.id where '
iffilter['l']:
iffilter['l']=='true':
s+='('
foriinrange(len(keywords)):
s+='LOWER(l.name) like LOWER(:kw'+str(i)+') AND '
s=s[:-5]
s+=') OR '
iffilter['p']:
iffilter['p']=='true':
s+='('
foriinrange(len(keywords)):
s+='LOWER(partno) like LOWER(:kw'+str(i)+') AND '
s=s[:-5]
s+=') OR '
iffilter['d']:
iffilter['d']=='true':
s+='('
foriinrange(len(keywords)):
s+='LOWER(description) like LOWER(:kw'+str(i)+') AND '