I know I'm a bit slow, but ...

On Wednesday, March 26, 2014 4:21:27 PM UTC-7, Dave S wrote:
>
> On Wednesday, March 26, 2014 12:58:36 PM UTC-7, Niphlod wrote:
>>
>> assuming.....
>>
>> count = db.table.id.count()
>> groupby = db.table.birthday.month()
>>
>> #you can do
>>
>> rows = db(db.table.id >0).select(count, groupby, groupby=groupby)
>> for row in rows:
>>     print row[count], row[groupby]
>>
>>
>>
>> i.e. the variables (count, groupby) you set are automatically 
>> "translated" to the "ugly format" you're referring to. 
>>
>
> Okay, that looks good.
>


Except for one tiny detail.  I don't want to print the results from the 
controller, I want the view to display them.  And when I do the for loop in 
the view,
I get a ticket for "NameError: name 'count' is not defined". How do I get 
the desired results from my controller to the view and out on the browser 
screen?

 
>
>> This is the only recommended way to deal with those, because the 
>> row['_extra']["web2py_extract('month',person.birthdate)"]
>>
>> is only valid for a specific adapter (in this case, sqlite). This means 
>> that if you switch to mysql, it won't work.
>>
>>
>








-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to