Formatting columns of SQL result
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
Try this (warning: untried code): <!--#in query_sql--> <tr> <td color="white"><!--#var "_['sequence-item'][0]"--></td> <td color="black"><!--#var "_['sequence-item'][1]"--></td> </tr> <!--#/in--> ----- Original Message ----- From: Christian Lindig <lindig@gaertner.de>
<!--#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-->
rOn Wed, 25 Aug 1999, Evan Simpson wrote:
Try this (warning: untried code):
<!--#in query_sql--> <tr> <td color="white"><!--#var "_['sequence-item'][0]"--></td> <td color="black"><!--#var "_['sequence-item'][1]"--></td> </tr> <!--#/in-->
----- Original Message ----- From: Christian Lindig <lindig@gaertner.de>
<!--#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-->
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
-- Andreas Kostyrka | andreas@mtg.co.at phone: +43/1/7070750 | phone: +43/676/4091256 MTG Handelsges.m.b.H. | fax: +43/1/7065299 Raiffeisenstr. 16/9 | 2320 Zwoelfaxing AUSTRIA
On Wed, 25 Aug 1999, Evan Simpson wrote: What about: <!--#in query_sql--><!-- select foo,bar from table--> <tr> <td color="white"><!--#var foo html_quote--></td> <td color="black"><!--#var bar html_quote--></td> </tr> <!--#/in--> same warning applies here too ;) Andreas
Try this (warning: untried code):
<!--#in query_sql--> <tr> <td color="white"><!--#var "_['sequence-item'][0]"--></td> <td color="black"><!--#var "_['sequence-item'][1]"--></td> </tr> <!--#/in-->
----- Original Message ----- From: Christian Lindig <lindig@gaertner.de>
<!--#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-->
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
-- Andreas Kostyrka | andreas@mtg.co.at phone: +43/1/7070750 | phone: +43/676/4091256 MTG Handelsges.m.b.H. | fax: +43/1/7065299 Raiffeisenstr. 16/9 | 2320 Zwoelfaxing AUSTRIA
On Wed, Aug 25, 1999 at 03:02:37PM +0200, Andreas Kostyrka wrote:
<!--#in query_sql--><!-- select foo,bar from table--> <tr> <td color="white"><!--#var foo html_quote--></td> <td color="black"><!--#var bar html_quote--></td> </tr> <!--#/in-->
Thanks - this is the way to go! Maintainers: Please add this (SQL Methods define column variables) to the ZSQL documentation. -- Christian -- Christian Lindig Gaertner Datensysteme GbR, Braunschweig, Germany http://www.gaertner.de/~lindig lindig@gaertner.de
participants (4)
-
Andreas Kostyrka -
Christian Lindig -
Christian Lindig -
Evan Simpson