Wonderfull approach and thanks for the explanation. I sometimes wish I had not slept all the time in mathclass @ school :-)
Thanks a lot On 21 Okt., 02:57, mdipierro <mdipie...@cs.depaul.edu> wrote: > qset is just a variable. You can call it "a" if you like. > > the idea is that > > a=db > > defines a set of all records of all table > > b=a(query1) > > defined a subset as limited by the query > > c=b(query2) > > defined a subset of the previous subset etc etc > > then you can do > > rows = c.select() > > to get all records in the set. > > On Oct 20, 7:46 pm, Sebastian Brandt <snoogi...@gmail.com> wrote: > > > One more question: > > What does qset actually do? > > > On 21 Okt., 02:24, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > I am not sure I understand but I am going to make a guess > > > > qset=db(db.events.severity==request.vars.severity)\ > > > (db.events.status==request.vars.status)\ > > > (db.events.status==db.status.id)\ > > > (db.events.severity==db.severity.id) > > > if request.vars.message: > > > qset=qset(db.events.message==request.vars.message) > > > if request.vars.host: > > > qset=qset(db.events.host==request.vars.host) > > > rows=qset.select(orderby=~db.events.datetime_submitted) > > > > On Oct 20, 6:28 pm, Sebastian Brandt <snoogi...@gmail.com> wrote: > > > > > Hi everyone, > > > > > I am trying to create a dynamic SQL Query. > > > > I have a form where a user can input several fields. I want to perfom > > > > a query whether a user has filled out all fields or not. > > > > > Got the following code: > > > > > if not request.vars.message: > > > > request.vars.message='' > > > > if not request.vars.host: > > > > request.vars.host='' > > > > rows=db(db.events.host==request.vars.host) > > > > (db.events.message==request.vars.message) > > > > (db.events.severity==request.vars.severity) > > > > (db.events.status==request.vars.status)(db.events.status==db.status.id) > > > > (db.events.severity==db.severity.id).select > > > > (orderby=~db.events.datetime_submitted) > > > > form=SQLFORM(db.events) > > > > return dict(form=form,rows=rows) > > > > > If message and/or host are empty I get an empty query. Can I avoid > > > > this anyhow or do I have to code a huge if-else-thingy to get my > > > > result? :-) > > > > > Greetings > > > > > Sebastian Brandt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---