On Friday, July 8, 2016 at 12:13:41 PM UTC-7, Richard wrote:
>
> Answer is yes it work just fine...
>
> db(db.ref_colorimeter_color.filter_parameter.belongs(['delta_a', 
> 'delta_a_b'])).select(db.ref_colorimeter_color.color, 
> orderby="substring(color, '\(([^\)]+)\)')")
>
> But with this :
>
> db.ref_colorimeter_color.color.regexp('\(([^\)]+)\)')
>
> It doesn't seems to work as DAL translate it into :
>
> SELECT  ref_colorimeter_color.color 
>    FROM ref_colorimeter_color 
> WHERE (ref_colorimeter_color.filter_parameter IN ('delta_a_b','delta_a')) 
> ORDER BY (ref_colorimeter_color.color ~ '\(([^\)]+)\)');
>
> Which don't seems to help in sorting record... I try to understand why 
> regexp get translated that way :
>
>
>
> https://github.com/web2py/pydal/blob/e1136b6e29e4dbeb878cf9718c053aa790d909b5/pydal/dialects/postgre.py#L78
>
> I am not sure the rational of :
>
> order by field_name ~ regexp
>
> I can find anything in postgres documentation as far as my search goes...
>
> Richard
>
>
OT:  that's one of those regexps that makes me dizzy.  Trying to find 
strings that begin with a part in parentheses?

/dps

 

>
>
>
> On Fri, Jul 8, 2016 at 1:04 PM, Richard <ml.richa...@gmail.com 
> <javascript:>> wrote:
>
>> Can we do that :
>>
>>
>> http://stackoverflow.com/questions/8989098/postgres-order-data-by-part-of-string
>>
>> ?
>>
>> Maybe like this ?
>>
>> orderby='substring(tablename.fieldname, ...)'
>>
>> ??
>>
>> Thanks
>>
>> Richard
>>
>> -- 
>> 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+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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