This two
{{=row._extra[db.mytable.id.count()]}}
{{=row._extra['COUNT(myvar.id)']}}
should be equivalent. Please try again.
Massimo
On Mar 6, 12:45 pm, Joe Barnhart <[email protected]> wrote:
> According to the web2py book, we can use 'count' as a field by first
> delcaring a variable:
>
> count=db.mytable.id.count()
>
> Then using it in the select statement:
>
> db().select(db.mytable.somefield,count,groupby=db.mytable.somefield)
>
> Then to access it we use the "_extras" variable:
>
> {{=row._extra[count]}}
>
> Only.... this does not work. After some experimentation I found it
> needed to be a little more specific:
>
> {{=row._extra['COUNT(myvar.id)']}}
>
> I thought this should be documented somewhere, and the forum seems to
> be the place for this.
>
> -- Joe B.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---