Hi,
Assuming I want to create an ajax query that will filter the results 
according to some data in fields:
 for example: ajax url:  ... eco/1/6/4/5/3

def eco:
    my_content = db.table.created_by == auth.user.id
    query_a = db.table.field_a == request.args(0)
    query_b = db.table.field_b== request.args(1)
    query_c = db.table.field_c == request.args(2)
    query_d = db.table.field_d == request.args(3)
    query_e = db.table.field_e == request.args(4)
    
    filtered_list = db((my_content) & (query_a) & (query_b) & (query_c) & 
(query_d) & (query_e)).select(,,,,,) 
    return dict(filtered_list = filtered_list)
I guess, so far so good.

Now if any arg == 0 , (for example: eco/2/0/0/0/3) I want it to skip that 
specific query.

So I want to a chive something like that:
    if request.args(0) != 0:
        query_a = db.table.field_a == request.args(0)
    else:
        query_a = db.table.field_a == ALL
   if request.args(01) != 0:
        etc"...

with what should I replace the ALL? or the else part?

Thanks.


    
        












-- 
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