That should work if you are passing in the name of the table as a string. If you're passing in the table object itself, then it should be:
row=db(table_to_query.id>0).select() As an aside, it helps if you report the error or traceback (or explain in more detail than "does not work"). Anthony On Thursday, May 23, 2013 6:22:00 PM UTC-4, Ramos wrote: > > hello > i have 4 functions to do the same query. > db(db.mytable1.id>0).select() > db(db.mytable2.id>0).select() > db(db.mytable3.id>0).select() > db(db.mytable4.id>0).select() > > Maybe i can use only one like this > > > def f1(table_to_query): > row=db(db[table_to_query].id>0).select() > > it does not work > > > what is the correct syntax? > > > in console i can see that the next code works > table_to_query='mytable' > print db[table_to_query].fields > output > ['id','field1','field2',etc....] > > > -- --- 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.