query = ((db.paymenttype.id 
<http://www.google.com/url?q=http%3A%2F%2Fpaymenttype.id&sa=D&sntz=1&usg=AFQjCNEFnRbTZjMNUFo0b4M7GS_h1FmFbg>
 
== request.vars.paymenttype) &
         (db.tariffrate.rate < request.vars.tariffrate) &
         [more conditions based on request.vars] &
         [conditions joining various tables involved in above queries])
grid = SQLFORM.grid(query)

Probably you need to review the documentation on queries 
<http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Logical-operators>
 
and joins. 
<http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Inner-joins>
 
Also, note that request.vars is a dictionary-like Storage object, so it is 
request.vars.variable_name, not request.vars(variable_name).

Anthony

On Monday, March 20, 2017 at 9:42:01 AM UTC-4, ross mclean wrote:
>
> Hi All,
>
> newbie in python and stuck on creating a query from a sqlform() suitable 
> to use for querying multiple table and returning in a datagrid.
>
>
>
> Each drop down is connected to a unique table -> I would like on submit to 
> used the request.vars and pass these in a query to return the data grid 
> like -
>
> select * from paymenttype, supplier, tariff, tariffrate 
> where
> paymenttype.id 
> <http://www.google.com/url?q=http%3A%2F%2Fpaymenttype.id&sa=D&sntz=1&usg=AFQjCNEFnRbTZjMNUFo0b4M7GS_h1FmFbg>
>  
> = request.vars(paymenttype) and tariffrate.rate<request.vars(tariffrate)
>
> Any pointers / ideas?
>
> Cheers
>
> Ross
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to