[Zope] print results from a datrabase query

Dieter Maurer dieter@handshake.de
Wed, 11 Jul 2001 21:00:38 +0200 (CEST)


Terry McKenna writes:
 > I am trying to query a field in a database then print
 > the output in both an email and an html file.
 > 
 > It looks like I am getting the memory address of the Z
 > SQL method instead of the value returned by the query.
 > ...
 > <dtml-var maxTicketNumQuery>
You get a "Shared.DC.ZRDB.Results.Results" object.
It behaves like a list of rows representing your query result.
Each row behave like an object the attributes of which are
the columns of your query.

Use something like:

    <dtml-let ticket=maxTicketNumQuery> <!-- this calls your method! -->
      ....
      <dtml-var "ticket[0].NUM"> <!-- assumed: select max(*) as NUM ... -->
      ....
    </dtml-let>


Dieter