sorry. you can but it really depends on details. In db(query).select()
query is a variable and you can do query=query1&query2 or query=query1|query2 query1 can be db[table][field]==value you can combine and build them as you wish in a loop. How you do this in practice depends on the representation of the input. On Jul 18, 8:29 pm, ionel <ionelanton...@gmail.com> wrote: > I think I wasn't clear. The user can make any selection to search the > database. > > Search Form example: > > [*] field1 = some_value1 > [ ] field2 > [*] field3 = some_value2 > [ ] field4 > [ ] field5 > [ ] field6 > etc. > > So, for this situation: > query = (db.table.field1=='some_value1')& > (db.table.field3=='same_value2') > > Next time he can change the selection: > > [ ] field1 > [*] field2 = some_value1 > [ ] field3 > [ ] field4 > [*] field5 = some_value2 > [*] field6 = some_value3 > > query = (db.table.field2=='some_value1')& > (db.table.field5=='same_value2')&(db.table.field5=='same_value3') > > I do not know what the user will select in advance. I need to generate > the query after his selection, in any field combination. > > On Jul 18, 9:14 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > yes > > > db(db.table.field0=='somevalue').select > > (db.table.field1,db.table.field2,orderby=db.table.field3) > > > On Jul 18, 7:58 pm, ionel <ionelanton...@gmail.com> wrote: > > > > Just to be more clear. The user can select multiples fields, from one > > > to all. > > > > On Jul 18, 8:55 pm, ionel <ionelanton...@gmail.com> wrote: > > > > > Hello everyone, > > > > > I have a table with multiples fields (20). The user can select the > > > > fields for searching the table. He can select one field or all the > > > > fields in any combination. I need to create a query with his > > > > selection. Is this thing possible in web2py but without using > > > > executesql() ? > > > > > Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---