I tried the below syntex. It works, throughs no errors but the list is not 
being filtered, (when selecting a value other than ALL):
def filter_eco_graph():
    my_graphs = db.t_tests_results.created_by == auth.user.id

    a = request.vars   # just for testing and it renders what is expected. 
()
    graph_query = (my_graphs)
    if request.vars.platform != 'ALL':
        platform_query = db.t_types.id == request.vars.platform
        graph_query = graph_query & (platform_query)
    if request.vars.project != 'ALL':
        project_query = db.t_projects.id == request.vars.project
        graph_query = graph_query & (project_query)
    if request.vars.device != 'ALL':
        device_query = db.t_devices.id == request.vars.device
        graph_query = graph_query & (device_query)
    if request.vars.milestone != 'ALL':
        milestone_query = db.t_milestones.id == request.vars.milestone
        graph_query = graph_query & (milestone_query)
    if request.vars.env !='ALL':
        env_query = db.t_envs.id == request.vars.env
        graph_query = graph_query & (env_query)


    graph_data = db(graph_query).select(join=db.t_tests.on(db.
t_tests_results.f_test == db.t_tests.id))
    return locals()











On Monday, February 24, 2014 5:03:36 PM UTC+2, Avi A wrote:
>
> thanks, yes i just realised i don't need the joint for the filtering.
>
> On Monday, February 24, 2014 4:57:37 PM UTC+2, Anthony wrote:
>>
>> t_b = db.t_b.f_x ==3
>>>
>>
>> Doesn't look like you do anything with the above. Why not:
>>
>> rows = db((db.t_a.created_by == auth.user.id) & (db.t_b.f_x == 3)).select
>> (
>>     join=db.t_b.on(db.t_a.f_test == db.t_b.id))
>>
>> Note, you can also do a join via:
>>
>> rows = db((db.t_a.created_by == auth.user.id) & (db.t_b.f_x == 3) &
>>           (db.t_a.f_test == db.t_b.id)).select()
>>
>> Technically, that will implement the join via a SQL WHERE clause rather 
>> than the JOIN statement.
>>
>> Anthony
>>
>

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