I'm trying to create a SQLFORM.grid in web2py that group 2 fields and count
them up, but I couldn't figure it out how to do it.
*Model*
db.define_table('invocados',
Field('modulo_servico', 'string', label='Módulo (Serviço)',
default=IS_LENGTH(2)),
Field('servico', 'string', default=IS_LENGTH(8)),
)
*Controller*
fields=(db.invocados.modulo_servico,
db.invocados.servico)Invocados=SQLFORM.grid(db.invocados.modulo_servico !=
db.invocados.modulo_consumidor, details=False, fields=fields,
groupby=(db.invocados.modulo_servico | db.invocados.servico) , paginate=15)
I'm trying to count all records grouped by modulo_servico and servico. I've
tried:
fields=(db.invocados.modulo_servico, db.invocados.servico, db.invocados.count())
but it doesn't work.
Can somebody help?
--
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.