Hello,
If I define a table with
define_table('test',Field('name'),Field('firstname'))
Then in the controller, I have:
count = db.test.id.count()
data = db().select(db.test.ALL,
count.with_alias('newName'),
groupby=db.test.id,
orderby=db.test.name)
In the view displaying data as json (view.jason) I get:
{"data": [{"test": {"name": "UserName", "firstname": "FirstName"},
"newName": 1, "_extra": {"COUNT(test.id) AS newName": 1}}, ...
Which I thought was not correct, but Massimo said this is the intended
behaviour as 'count' does not belong necessarily to a table.
So can someone help me and give me a hint on how I could format the json
output like:
{"data": [{"test": {"name": "UserName", "firstname": "FirstName",
"newName": 1}, ... ?
Thanks in advance for your feedback!
Andre
--