I'm trying to learn to use the DAL. I've been reading through chapted 6 of the web2py book and I'm sorry if I missed the answer there, but here I go!
A user enters his/her postcode and this is checked against an API which issues us back the 10 closest postcodes. We store the 10 closest postcodes as a list of tuples called 'postcodes' which looks like this: [('0.49769486428969', 'HU12NE'), ('0.49842635239737', 'HU91DR')] My database contains a table called data with a field named postcode I want to then check the database and see if any of my data.postcode fields contain a postcode which matches that returned by the postcodes list. If they do, I want the id and the name. Would this be done like that or am I missing the point (please forgive typo etc, quickly typed this up in a browser)? results=[] for postcode in postcodes: rows=db(db.data.postcode==postcode[1]).select() for row in rows: data=[row.id,row.name] results.append(data) Thank you! Chris