[web2py] Re: Best way to implement SQL select query

2014-04-17 Thread Niphlod
you can use "contains" for 'text' fields if you want it turned to a "LIKE '%whatever%' query, or as a "find me where 'whatever' is" in a 'list:string' field. at this point a bit of code wouldn't hurt :D On Thursday, April 17, 2014 5:07:38 PM UTC+2, Rob Goldsmith wrote: > > Thanks Joe - changing

[web2py] Re: Best way to implement SQL select query

2014-04-17 Thread Rob Goldsmith
Thanks Joe - changing the query to *belongs *did the trick although the query is still very slow when the list is long - but I'm not sure if that's primarily because I'm using sqlite at this stage? Niphlod - f_postcode is of type text and result is a list of strings (e.g. ['W1 2TR', 'SW1 5AB' .

[web2py] Re: Best way to implement SQL select query

2014-04-16 Thread Joe Barnhart
You probably want "belongs" instead of "contains". It's a common mistake (which I make regularly myself). The "contains" function in web2py is to test if strings are contained in a field, i.e. db.mytable.myfield.contains("joe") is like db.mytable.myfield.like("%joe%"). "Belongs" is used to

[web2py] Re: Best way to implement SQL select query

2014-04-16 Thread Niphlod
what field type is f_postcode ? what type is the result variable ? On Wednesday, April 16, 2014 2:39:02 PM UTC+2, Rob Goldsmith wrote: > > I tried posting this earlier, but it doesn't seem to have appeared yet - > so apologies if this comes up twice. > > I am writing a web2py application which ac