you need to build the query dinamically
queries = []
for segment in mylist:
     queries.append(db.mytable.myfield.startswith(segment))
query = reduce(lambda a,b:(a|b),queries)
results = db(query).select()



Il giorno lunedì 26 novembre 2012 12:58:29 UTC+1, Joel Samuelsson ha 
scritto:
>
> I have a function which takes a list of prefixes the data from a select 
> can start with. The list is of unknown size. I found that the contains 
> function (db.mytable.myfield.contains('value')) can take a list instead 
> of 'value'. When I try this with the startswith function (
> db.mytable.myfield.contains('value')) I get an error. Is there any way I 
> can get similar behaviour to contains but with startswith without moding 
> web2py?
>
> Best regards,
> Joel
>

-- 



Reply via email to