This query1 = SQLTABLE(db().select(db.Flight.DepartureDate == request.vars.DepartureDate))
is wrong in many ways. First of all it is not a query (it is an HTML table). Second, you pass a query as argument of select. That does not mean what you think it does. Should be def displayFlights(): query1 = db.Flight.DepartureDate == request.vars.DepartureDate query2 = db.Flight.ArrivalLocation == request.vars.ArrivalLocation query3 = db.Flight.DepartureDate == request.vars.DepartureDate query4 = db.Flight.ArrivalDate == request.vars.ArrivalDate rows = db(query1 & query2).select(db.Flight.ALL) return dict(rows=rows) On Wednesday, 16 January 2013 20:40:13 UTC-6, Mihir Lade wrote: > > Hi Anthony, > > I am currently working with this code: > > def displayFlights(): > query1 = SQLTABLE(db().select(db.Flight.DepartureDate == > request.vars.DepartureDate)) > query2 = SQLTABLE(db().select(db.Flight.ArrivalLocation == > request.vars.ArrivalLocation)) > query3 = SQLTABLE(db().select(db.Flight.DepartureDate == > request.vars.DepartureDate)) > query4 = SQLTABLE(db().select(db.Flight.ArrivalDate == > request.vars.ArrivalDate)) > > rows = db(query1 & query2).select(db.Flight.ALL) > return dict(rows=rows) > The error I am currently getting with this code is: > > Error traceback > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > 10. > 11. > 12. > 13. > 14. > 15. > 16. > > Traceback (most recent call last): > File "I:\wdd-softw\web2py\gluon\restricted.py", line 184, in restricted > exec ccode in environment > File *"I:/wdd-softw/web2py/applications/Assignment/controllers/default.py"* > <http://127.0.0.1:8000/admin/default/edit/Assignment/controllers/default.py>, > line 115, in <module> > File "I:\wdd-softw\web2py\gluon\globals.py", line 103, in <lambda> > self._caller = lambda f: f() > File *"I:/wdd-softw/web2py/applications/Assignment/controllers/default.py"* > <http://127.0.0.1:8000/admin/default/edit/Assignment/controllers/default.py>, > line 107, in displayFlights > query1 = SQLTABLE(db().select(db.Flight.DepartureDate == > request.vars.DepartureDate)) > File "I:\wdd-softw\web2py\gluon\sql.py", line 2913, in select > return self.parse(db,rows,self.colnames) > File "I:\wdd-softw\web2py\gluon\sql.py", line 2932, in parse > field = table[fieldname] > File "I:\wdd-softw\web2py\gluon\sql.py", line 1481, in __getitem__ > return dict.__getitem__(self, str(key)) > KeyError: "DepartureDate='01/19/2013'" > > > > --