This comes up once in a while and the answer is no.

The problem is that SQLTABLE may need to display the result of a join
where the same field appears has two columns and some columns may be
computed from expressions. They do not have a label and even if they
do, using label would be confusing. This would require so much
configuration that the best solution is NOT to use SQLTABLE but just
loop over the rows.

Massimo


On Sep 10, 11:43 am, villas <villa...@gmail.com> wrote:
> It seems strange that the db.field 'label' is not used as the column
> header by default in SQLTABLE.  After all,  if someone has gone to the
> trouble of specifying a 'label',  surely they would wish to use it
> everywhere.  I eventually found this excellent tip from Massimo.
>
> Controller:
> headers=dict([(c,db[c.split('.')[0]][c.split('.')[1]].label) for c in
> rows.colnames])
>
> View:
> {{=SQLTABLE(rows, headers=headers)}}
>
> Please could we add this functionality to the core?  Or, at least
> include it in the book, (sorry if I missed it).
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to