| persons.name | persons.age | persons.location | persons.occupation | persons.interests | |
| Carl | 23 | London | Neuroscientist | brainy stuff | |
| Junior | 25 | Tokyo | doctor | medical research | |
| Maggie | 33 | Nairobi | farmer | GMO research | |
| Tom | 25 | Sydney | teacher | educational ideas | |
| Derrick | 21 | Chicago | surgeon | Cutting through |
rows_name = db().select(db.persons.name).column()
rows = db(db.persons.ALL).select()
for row in rows:
if rows_name[0] == 'Maggie':
for row in rows:
return [row.age+' '+row.location+' '+row.occupation+' '+row.interests]rows = db(db.person.id>0).select()
random_number = random.randrange(0, rows.count())
row = rows[random_number]
return rowreturn '%s, %s, %s, %s' % (row.name, row.age, row.location, row.occupation)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
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/ynBOuIdufso/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 web2py+unsubscribe@googlegroups.com.
On Tue, May 1, 2018 at 8:33 AM, Maurice Waka <mauri...@gmail.com> wrote:
I get this error : AttributeError: 'Rows' object has no attribute 'count'
On Mon, 30 Apr 2018, 22:10 pbreit <pbreit...@gmail.com> 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
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/ynBOuIdufso/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 web2py+un...@googlegroups.com.
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/ynBOuIdufso/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
Now another error :invalid syntax: random _number = random.randrange(0,rows.count())