I came up with a first version that works: def operator_field_starts(field, first_int, query_env={}): '''bla bla ''' if not field.type.startswith('list:'): raise AttributeError, "bla bla bla" dialect = field._dialect arg = '|'+dialect._like_escaper_default(str(first_int))+'|%' op = dialect.like return op(field, arg, escape='\\', query_env=query_env)
from pydal.objects import Query def field_starts(field, first_int): db = field._db return Query(db, operator_field_starts, field, first_int) and then it is used like this: db( field_starts(db.operation.parameters, my_parameter) & (db.operation. canceled==True))._count() I feel it would be more efficient to use SUBSTR instead of LIKE, so I'll go for a second version... Regards -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/0c32d063-ad65-46a8-beb2-0bf4e1eb212c%40googlegroups.com.