http://thadeusb.com/weblog/view/web2py_dynamic_queries
-Thadeus On Thu, Apr 8, 2010 at 5:35 AM, DenesL <[email protected]> wrote: > Yes > > q1 = db.software.os == os > q2 = db.software.x == y > > filter1 = q1 & q2 # q1 and q2 > filter2 = q1 | q2 # q1 or q2 > filter3 = ~q1 & q2 # not q1 and q2 > > set1 = db(filter1) > > and then use select, count, delete, update on sets > > rows1=set1.select() > > see web2py book section 6.5 for more details > > On Apr 8, 4:36 am, selecta <[email protected]> wrote: >> is it possible to build database queries from smaller pieces >> >> I had something in mind like >> >> filter = [] >> for key,value in session.filter.iteritems(): >> if key.startswith('os') and value: >> os = key.split()[1] >> filter.append( (db.software.os == os) ) >> ... >> return UL([LI(s.name) for s in >> db(db.software.id>0)&filter.select()]) > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

