First Last
- ---------- ----------
1 Jim Sanders
2 Bill Van Der Wall
3 John St James
4 Peter Williams
5 Jim Hensen
6 John Adams
7 William Tell
8 Adam Johnson
Search Text Rows Returned- ---------------- ------------------
1 Jim 1, 5
2 John 3, 6, 8
3 Adam 6, 8
4 Bill 2
5 Jim Sanders 1
6 Adam John 8
7 John St James 3
--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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
you can use the 'like' condition in w2p, something like this:query = ((db.auth_user.like('%s%' form.var.name) or (db.auth_user.like('%s%' form.var.name))))
def search(sfields, keywords):
keywords = keywords.strip().replace("'", "''")
return "CONCAT(first_name, ' ', last_name) LIKE '%%%s%%'" % keywords
grid = SQLFORM.grid(db.mytable, searchable=search) return "%s LIKE '%%%s%%'" % (db._adapter.CONCAT('first_name', ' ', 'last_name'), keywords)Traceback (most recent call last):
File "C:\dev\web2py\gluon\restricted.py", line 216, in restricted
exec(ccode, environment)
File "C:\dev\web2py\applications\connect\controllers/user.py:index", line 281, in <module>
File "C:\dev\web2py\gluon\globals.py", line 405, in <lambda>
self._caller = lambda f: f()
File "C:\dev\web2py\gluon\tools.py", line 4299, in f
return action(*a, **b)
File "C:\dev\web2py\applications\connect\controllers/user.py:index", line 72, in index
AttributeError: 'MySQL' object has no attribute 'CONCAT'
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/3RnGSoUbxxY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
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+unsubscribe@googlegroups.com.
I meant what was the code that produced that CONCAT exception?
queries = [db.auth_user.id > 0]queries.append("%s LIKE '%%%s%%'" % (db._adapter.CONCAT('first_name', ' ', 'last_name'), searchText)
--