And, actually it gives me error ticket if try "model_id starts with 7"
this for another field which is int not string.

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 194, in restricted
    exec ccode in environment
  File "C:/web2py/applications/pricelist/controllers/default.py", line
104, in <module>
  File "C:\web2py\gluon\globals.py", line 149, in <lambda>
    self._caller = lambda f: f()
  File "C:\web2py\gluon\tools.py", line 2456, in f
    return action(*a, **b)
  File "C:/web2py/applications/pricelist/controllers/default.py", line
39, in admin
    products = SQLFORM.grid(db.Product,deletable=False, paginate=10)
  File "C:\web2py\gluon\sqlhtml.py", line 1535, in grid
    subquery = smart_query(fields,key)
  File "C:\web2py\gluon\dal.py", line 4005, in smart_query
    elif op == 'startswith': new_query = field.startswith(value)
  File "C:\web2py\gluon\dal.py", line 5255, in startswith
    raise SyntaxError, "startswith used with incompatible field type"
SyntaxError: startswith used with incompatible field type



On Sep 30, 5:39 pm, Omi Chiba <[email protected]> wrote:
> Massimo,
>
> I was like what are you talking about ? , then I noticed you actually
> asking to input whole thing between " and "...
>
> Yeah, it works !! but I cannot ask my users to do.
>
> Like Niphlod said, option flag to switch the search method will be
> great.
>
> On Sep 30, 5:29 pm, Massimo Di Pierro <[email protected]>
> wrote:
>
>
>
>
>
>
>
> > type in the search field "part_number starts with ab"
>
> > On Sep 27, 6:20 pm, Omi Chiba <[email protected]> wrote:
>
> > > For example, I have a field which has 'abcab' and 'bcabc' data.
> > > If I provide 'ab' in the search box, I want to just pull the first one
> > > ('abcab') and exclude second one ('bcabc'). Can we do this ?
>
> > > models/db.py
> > > ---------------------
> > > db.define_table('Product',
> > >     Field('Part_Number'))
>
> > > controllers/default.py
> > > ------------------------------
> > > def admin():
> > >     products = SQLFORM.grid(db.Product,deletable=False, paginate=10)
> > >     return dict(products = products)

Reply via email to