since form.vars holds validated request.vars, after form.accepts( ),
look at the structure of your form.vars, and then you'll see what you need to do to build up your query from the user response. you can show them in your page, for development, with {{=BEAUTIFY(form.vars)}} and compare that with {{=BEAUTIFY(request.vars)}} On Sat, Jul 18, 2009 at 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 -~----------~----~----~----~------~----~------~--~---