[Zope] Formatting columns of SQL result

Christian Lindig lindig@gaertner.de
Wed, 25 Aug 1999 14:43:44 +0200


I'm looking for a way to format *columns* from a SQL query
differently.  Sorry if this is a FAQ - but I did not find it neither
in the SQL nor in the DTML documentation.

The standard way of turning the result of a SQL query into a table is
something like this:

        <!--#in query_sql-->
            <tr>
                <!--#in sequence-item-->
                    <td><!--#var sequence-item--></td>
                <!--#/in-->
            </tr>
        <!--#/in-->

Especially all <td>'s are formatted equally. I'm looking for something
like this (which is illegal in Zope):

        <!--#in query_sql--><!-- select foo,bar from table-->
            <tr>
                <td color="white"><!--#var sequence-item[0]--></td>
                <td color="black"><!--#var sequence-item[1]--></td>
            </tr>
        <!--#/in-->

The code above assumes that the result has at least two columns and
formats them differently.  Any clues?

-- Christian

-- 
 Christian Lindig       Gaertner Datensysteme GbR, Braunschweig, Germany 
                        lindig@gaertner.de http://www.gaertner.de/~lindig 
                        phone: +49-531 233 55 55 fax: +49-531 233 55 56