Thanks much Massimo,

Could you explain this statement further; *where value_to and value_from 
are not fields not the values of the source and destination. *

On Sunday, November 10, 2013 5:28:03 PM UTC-5, Massimo Di Pierro wrote:
>
> fare = db((db.order.depart_from==db.fare_table.from) & 
> (db.order.arrive_to==db.fare_table.to)).select(db.fare_table.fare)    
>
> should be
>
> fare = db((db.order.depart_from==value_from) & 
> (db.order.arrive_to==value_to)).select(db.fare_table.fare)    
>
> where value_to and value_from are not fields not the values of the source 
> and destination.
>
>
> On Sunday, 10 November 2013 15:55:34 UTC-6, raferbop wrote:
>>
>> Good days guys,
>>
>> I created an order form with the following fields (db.order);
>>
>>    - Departure Location
>>    - Arrival Location
>>    - Date
>>    
>> I wanted to display fares between each departure and arrival location, so 
>> I created a fare table (db.fare_table);
>>
>> id      depart_city    arrival_city     fare
>> 1       NYC             Miami           800.00
>> 2       Miami           NYC             800.00
>>
>> The goal was display fares when the user selected a departure and arrival 
>> location (from a drop-down box), so I wrote the following query;  
>>
>> fare = db((db.order.depart_from==db.fare_table.from) & 
>> (db.order.arrive_to==db.fare_table.to)).select(db.fare_table.fare)    
>>
>> But this query returns all the fares that have been submitted to the 
>> order.db table. So I would like to know if it's possible to query the 
>> database, prior to the data being submitted, and if yes, how do you go 
>> about doing it?
>>
>> Regards,
>> Rafer
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to