Do you mean something like:
form = SQLFORM.factory(Field('key')).process()
if form.accepted and form.vars.key:
search_product = form.vars.key
rows = db((db.model.id == db.product.model) &
(db.product.quantity > 0)
)((db.product.serial_no.contains(search_product) ) |
(db.product.product_no.contains(search_product) ) |
(db.model.name.contains(search_product) ) ).select(db.product.ALL)
else: rows= None
On Tuesday, 20 January 2015 08:45:45 UTC-6, 黄祥 wrote:
>
> hi,
>
> is it possible to create more simple form field for search in some table
> coloumn?
> e.g.
> search_product = request.vars.search_product
> if search_product:
> rows = db((db.model.id == db.product.model) &
> (db.product.quantity > 0)
> )((db.product.serial_no.contains(search_product) ) |
> (db.product.product_no.contains(search_product) ) |
> (db.model.name.contains(search_product) ) ).select(db.product.ALL)
>
> example above is work, but, wondering is there any simple method to
> achieve this using web2py way?
>
> thanks and best regards,
> stifan
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.