On Friday, February 14, 2014 10:56:09 AM UTC-5, John Drake wrote:
>
> Hello.  I'm having a strange problem.  I'm trying to get the count of a 
> rows object from a query.  Here is the code:
>
> def album_show():
>     album = db.t_album(request.args(0))
>     songs = db(db.t_song.f_album_id_reference==album.id).select()
>     count = songs.count()
>     return locals()
>
> And here is the error I get:
>
> AttributeError: 'Rows' object has no attribute 'count'
>
>
> This makes no sense.  The web2py manual clearly states that "count()" is a 
> function of the rows object.
>

No, it's a method of the Set class, not the Rows class.

song_set = db(db.t_song.f_album_id_reference==album.id)
count = song_set.count()
songs = song_set.select()

Anthony

-- 
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/groups/opt_out.

Reply via email to