After browsing the sqlite docs, I figured out to count my bithdays per month
for the table corresponding to the model
db.define_table(
'person',
Field('surname','string', length=25),
Field('birthdate', 'date'))
Then I found Niphlod's post that gave the DAL-ese I needed
at <https://groups.google.com/d/msg/web2py/zQLJEzr23gQ/6Cf4YiZY41sJ>
adjusted to
results = db().select( count, groupby, groupby=groupby )
return dict(records=results)
(There aren't a lot records, so I don't need to restrict the range)
This sort of works in the view:
{{for row in records:}}
<li>{{=row['_extra']}}</li>
{{pass}}
</ul>
in that all the desired information is there, but it is hard to read.
I can pull the fields I need out by doing stuff like
{{=row['_extra']['COUNT(person.id)']}}
{{=row['_extra']["web2py_extract('month',person.birthdate)"]}}
which I can figure out from the ugly way, but I suspect I'm missing
some better (easier to maintain?) way to doing the display.
Any suggestions?
(By the way, the xml() method on the Rows object seems to make <TR>s
but without any <TD>s inside, which kind of spoils using it to
display the data.)
2.9.2 on W7 Ultimate
/dps
Then
--
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/d/optout.