Answered on Stack Overflow: http://stackoverflow.com/a/14358733/440323

First, Alan is correct -- you cannot use "is" to create queries (that will 
just create booleans rather than queries). You must use ==, !=, <, >, <=, 
>=, &, |. These operators have been overloaded so that when used with DAL 
Field objects, they produce Query objects rather than booleans.

Second, some of your fields are date fields, but all request.vars are 
strings -- so you have to first convert the date strings to date objects. 
As suggested on SO, this will be easier if you instead use a web2py form -- 
after form processing, all the variables in form.vars will already be 
converted to the appropriate types.

Anthony

On Wednesday, January 16, 2013 6:25:09 AM UTC-5, Mihir Lade wrote:
>
> Hi Alan, 
>
> I tried changing to == however now it won't return any data at all... 
> Another way i was trying was.. 
>
> def displayFlights():
>     tuples=db((db.Flight.DepartureLocation is 
> request.vars.DepartureLocation)&
>        (db.Flight.ArrivalLocation is request.vars.ArrivalLocation)&
>        (db.Flight.DepartureDate is request.vars.DepartureDate)&
>        (db.Flight.ArrivalDate is 
> request.vars.DepartureDate)).select(db.Flight.ALL)
>     return dict(tuples=tuples)
>
> but that does the same thing where it just displays all the flights in the 
> table and not the ones preferred by the user.. 
> any other suggestions?
>

-- 



Reply via email to