Very nice! It's working for me like this:

def getValueByID(table, field, id):
    return db(db[table].id == id).select().first()[field]

Thanks Massimo!

def dynamicQuery(table, field, value):
    return db(db[table][field]id == value).select()

Op vrijdag 5 juli 2013 12:56:16 UTC+2 schreef Remco K het volgende:
>
> Hi all,
>
> I have a question:
>
> I want to create queries dynamically:
>
> def dynamicQuery(table, field, value):
>     return db([table][field] == [value]).select()
>
> dynamicQuery('tableName', 'fieldName', 'value')
>
> Is there someone who can tell me how I can achieve this?
>
> Thanks in advance!
> Remco
>

-- 

--- 
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/groups/opt_out.


Reply via email to