Re: [web2py] Re: How to iterate through column items and display its rows data

2018-05-05 Thread Maurice Waka
Thanks. It worked On Sun, 6 May 2018, 06:03 Massimo Di Pierro wrote: > you know you can do > > row = db(db.person.id>0).select(limitby=(0,1),orderby='').first() > > > On Tuesday, 1 May 2018 17:06:26 UTC-5, pbreit wrote: >> >> I am very sorry, I need to be more careful with my replies. >> >> I wa

Re: [web2py] Re: How to iterate through column items and display its rows data

2018-05-05 Thread Massimo Di Pierro
you know you can do row = db(db.person.id>0).select(limitby=(0,1),orderby='').first() On Tuesday, 1 May 2018 17:06:26 UTC-5, pbreit wrote: > > I am very sorry, I need to be more careful with my replies. > > I wasn't sure if random needed to be imported but it looks like it does. > So: > > impor

Re: [web2py] Re: How to iterate through column items and display its rows data

2018-05-01 Thread pbreit
I am very sorry, I need to be more careful with my replies. I wasn't sure if random needed to be imported but it looks like it does. So: import random rows = db(db.person.id>0).select() random_number = random.randrange(0, len(rows)) row = rows[random_number] return row -- Resources: - http://

Re: [web2py] Re: How to iterate through column items and display its rows data

2018-05-01 Thread Dave S
On Monday, April 30, 2018 at 9:04:57 PM UTC-7, Maurice Waka wrote: > > Now another error :invalid syntax: random _number = > random.randrange(0,rows.count()) > > Is the typo just in your post, or in the code you are trying? (Remove space between "random" and "_number"). /dps On Tue, 1 May 20

Re: [web2py] Re: How to iterate through column items and display its rows data

2018-04-30 Thread Maurice Waka
Now another error :invalid syntax: random _number = random.randrange(0,rows.count()) On Tue, 1 May 2018, 06:55 pbreit wrote: > Very sorry. Try: > > random_number = random.randrange(0, len(rows)) > > > > On Monday, April 30, 2018 at 8:03:45 PM UTC-7, Maurice Waka wrote: >> >> I get this error : A

Re: [web2py] Re: How to iterate through column items and display its rows data

2018-04-30 Thread Maurice Waka
Thanks. I got the count. On Tue, 1 May 2018, 06:41 Sandeep Patel wrote: > Try this > rows = db(db.person.id>0).count() > > > On Tue, May 1, 2018 at 8:33 AM, Maurice Waka > wrote: > >> I get this error : AttributeError: 'Rows' object has no attribute 'count' >> >> On Mon, 30 Apr 2018, 22:10 pbr

Re: [web2py] Re: How to iterate through column items and display its rows data

2018-04-30 Thread pbreit
Very sorry. Try: random_number = random.randrange(0, len(rows)) On Monday, April 30, 2018 at 8:03:45 PM UTC-7, Maurice Waka wrote: > > I get this error : AttributeError: 'Rows' object has no attribute 'count' > > On Mon, 30 Apr 2018, 22:10 pbreit > > wrote: > >> I would think something like:

Re: [web2py] Re: How to iterate through column items and display its rows data

2018-04-30 Thread Sandeep Patel
Try this rows = db(db.person.id>0).count() On Tue, May 1, 2018 at 8:33 AM, Maurice Waka wrote: > I get this error : AttributeError: 'Rows' object has no attribute 'count' > > On Mon, 30 Apr 2018, 22:10 pbreit wrote: > >> I would think something like: >> >> rows = db(db.person.id>0).select() >

Re: [web2py] Re: How to iterate through column items and display its rows data

2018-04-30 Thread Maurice Waka
I get this error : AttributeError: 'Rows' object has no attribute 'count' On Mon, 30 Apr 2018, 22:10 pbreit wrote: > I would think something like: > > rows = db(db.person.id>0).select() > random_number = random.randrange(0, rows.count()) > row = rows[random_number] > return row > > -- > Resource