Thanks to all. I have test the first answer, from Bruno..
It's work! Thanks a lot, i'm searching/reading during a long time! I will test the others solutions, why i think they are more simple/ comprehensible for me :$ Best regards ps : sorry for the language On 10 fév, 23:18, Bruno Rocha <rochacbr...@gmail.com> wrote: > > *queries=[]* > > *if arg1 == "x": queries.append(db.table.field == x)* > > *if arg2 == "y": queries.append(db.table.otherfield == y)* > > *# many conditions here....* > > *query = reduce(lambda a,b:(a&b),queries)* > > *db(query).select()* > > On Fri, Feb 10, 2012 at 8:10 PM, gbs <grosbe...@gmail.com> wrote: > > Hi, > > > i have search posts on this group, but i don't have found the solution > > of my question :$ > > > I have a table, wich display record of a database, nothing weird.. > > > I have made a form, so you can "filter" the result. > > > You can check "Tag" of the record, "Status" of the record, so on... > > > How can i create an sql "requete/statement" : ?? > > > sql = "" > > -- if tag : > > sql += "tag = xxx" > > -- if status: > > sql += " and status = xxx" > > > result = db(sql).select() > > > it's just an example, wich don't work, but i don't understand how to > > chain condition of a query :$ > > > Best regards > > -- > > Bruno Rocha > [http://rochacbruno.com.br]