Tim, a quick & dirty way would be as follows (note that this code is
not formal, i.e. it does not use represent, formatter, etc. and
neither takes into account field types such as blob and upload which
need alternate handling, see the SQLTABLE source in gluon/sqlhtml.py
for details. Joins are not supported):

tbody=[]
for col in rows.colnames:
  fld=col.split('.')[1]
  r=[TH(col,_scope=row')]
  for row in rows:
    r.append(TD(row[fld]))
  tbody.append(TR(*r))
tbl=TABLE(*tbody)

Denes.

On Apr 20, 5:29 am, Timmie <[email protected]> wrote:
> Hello,
> I asked how to change the output of a query result [1].
> As my table is rather huche and I do not want to force my users to do
> vertical scrolling, I would like to transpose the SQLTABLE:
>
> instead of:
>
> header1              header2              header3
> value_row1         value_row1         value_row1
> value_row2         value_row2         value_row2
>
> I would like to have:
>
> header1    value_row1     value_row2
> header2    value_row1     value_row2
> header3    value_row1     value_row2
>
> What is the most efficient way to achieve this?
> It's as if I would just pass the query result through BEAUTIFY but
> with improved header and same ordering of headers as in the input
> form.
>
> Thanks in advance,
> Timmie
>
> [1]: automatically customising query result 
> -http://groups.google.com/group/web2py/browse_thread/thread/38e3b95e18...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to