ok. You just want

for row in rows: print row.auth_user.first_name, row(count)

On Oct 14, 6:17 am, Alex <[email protected]> wrote:
> Sure thing.
>
> I have something like:
>
>     count = db.game_session.createdBy.count()
>     rankings = db((db.game_session.gameWinner == "1") &
> (db.game_session.createdBy ==
> db.auth_user.id)).select(db.auth_user.first_name,
> db.auth_user.last_name, count, groupby=db.game_session.createdBy)
>
>     return dict(rankings = rankings)
>
> On the view I just want to get to reference/display the count column
> in each row.
>
> Thanks!
>
> On Oct 14, 12:32 am, mdipierro <[email protected]> wrote:
>
> > show us the query.
>
> > On Oct 13, 10:47 pm, Alex <[email protected]> wrote:
>
> > > Hello,
>
> > > I have a query that does a select and COUNT on my model.  I wish the
> > > present the COUNT value of each row on the view but am having trouble
> > > figuring out the syntax for doing this.
>
> > > I have a for loop, iterating through each row in the resultset and
> > > tried to follow the example in the book, by using {{=row[count]}} but
> > > to no avail.
>
> > > I took a look at the objects in the row, and noticed that an "_extra"
> > > object is returned in the resultset.  Looking at the keys in the
> > > "_extra" dictionary, I do see the key based on my COUNT column:
>
> > >    ie.  COUNT(db.table_name.column)
>
> > > I tried to access the count value with {{=rows._extra.colName}}, but
> > > still had no luck.  Is there something obvious I am missing?
>
> > > Thanks!
>
> > > I have tried something like:
>
> > >   {{for row in ranking:}}
> > >   <tr>
> > >     <td>{{=row.auth_user.first_name}} {{=row.auth_user.last_name}}</
> > > td>
> > >     <td>{{=row[count]}}</td>
> > >   </tr>
> > >   {{pass}}- Hide quoted text -
>
> > - Show quoted text -
>
>

Reply via email to