Thank you, that works! Along the same line, would we then use "!" or "~" 
for not, and "|" for or? Do you know if this is documented in the book or 
is it only documented in the code/API?

If Massimo reads this, I would suggest that an eventual feature to add to 
web2py is for query objects to allow Python-like complex boolean 
expressions by overriding the key words "and", "or", and "not".

On Monday, March 25, 2013 12:15:26 PM UTC-4, Jonathan Lundell wrote:
>
> On 25 Mar 2013, at 9:13 AM, David Ripplinger <dal...@gmail.com<javascript:>> 
> wrote:
>
> I want to create a query object with multiple constraints, just like 
> adding commas in the WHERE clause of an sql query. I tried the intuitive 
> "constraint1 and constraint2" but it just took constraint2 and ignored 
> constraint1 (probably because the key word "and" isn't overridden and when 
> applied to two non-null objects simply takes the latter in Python).
>
> How do I do complex constraints in web2py query objects? I couldn't find 
> any examples easily in the book.
>
>
>
> Use "((constraint1) & (constraint2))"
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to