also work with list types. On Monday, 19 October 2015 13:03:14 UTC-5, Dave S wrote: > > > > On Sunday, October 18, 2015 at 5:28:14 PM UTC-7, 黄祥 wrote: >> >> something like this is not work either >> e.g. >> table= db.test >> search = request.vars.search >> field_objects = [f for f in table] >> if search: >> for field_object in field_objects: >> rows = db(field_object.contains(search)).select() >> >> Traceback >> >> 1. >> 2. >> 3. >> 4. >> 5. >> 6. >> 7. >> 8. >> 9. >> 10. >> 11. >> 12. >> 13. >> 14. >> >> Traceback (most recent call last): >> File "C:\web2py\gluon\restricted.py", line 227, in restricted >> exec ccode in environment >> File "C:/web2py/applications/freelancer/controllers/service.py" >> <https://127.0.0.1/admin/default/edit/freelancer/controllers/service.py>, >> line 19, in <module> >> File "C:\web2py\gluon\globals.py", line 412, in <lambda> >> self._caller = lambda f: f() >> File "C:/web2py/applications/freelancer/controllers/service.py" >> <https://127.0.0.1/admin/default/edit/freelancer/controllers/service.py>, >> line 13, in browse >> return freelancer_default.show_0(table, link_page) >> File "applications\freelancer\modules\freelancer_default.py", line 59, in >> show_0 >> rows = current.db(field_object.contains(search)).select(limitby = >> limitby, >> File "C:\web2py\gluon\packages\dal\pydal\objects.py", line 1247, in >> contains >> raise SyntaxError("contains used with incompatible field type") >> SyntaxError: contains used with incompatible field type >> >> >> any hints or suggestion to search all the fields in database table? >> > > > Isn't it the case that "contains()" is only for strings? You have at > least 1 non-string field type (id). It seems you would need to do an > "isinstance()" on the field type. > > /dps > > > >
-- 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.