~cd.value.contains(filter_value_inc, all=False)

~ = NOT

On Thursday, 26 June 2014 09:52:02 UTC-5, Douglas Campbell wrote:
>
> Hello,
>
> I am trying to filter out specific values in an SQLFORM.grid but I can not 
> figure out how to do this in the Query. Right now I have something like:
>
>          (cd.value.contains(filter_value_inc, all=False))
>
>
> And this gets the values that I want to be included. filter_value_inc 
> holds a list of strings that I want to include. Now I want to also have a 
> filter_value_exc that holds a list of strings I want to EXCLUDE from the 
> query, basically the exact opposite of what the .contains() does. 
>
>
> Example:
>
> database values:
> Red-Green
> Blue-yellow
> Blue-Green
> Blue-Red
> Red-Orange
> Green-Red
>
> I want to include everything that has Red in it AND exclude everything 
> with Blue. The values I would want it to return is Red-Green, Red-Orange, 
> and Green-Red but exclude Blue-Red since it contains "Blue". 
>
>
> I know how to do this using pure SQL but I am having a hard time figuring 
> out how to do it in Web2Py. 
>
>
> Thanks!
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to