[Zope] Calling a Z SQL Method directly

Douglas Bates bates@stat.wisc.edu
11 Mar 2000 22:30:22 -0600


I am a little confused about how to call a Z SQL Method directly from
within a DTML document or a DTML Method.

The application is web-based access to a bibliographic database.  I
have one Z SQL Method that looks up publications by author names, or
by words in the title, or by keywords.  I set up a search interface to
that method.  I am now trying to modify the DTML Method for generating
a report from such a query.  I have read the Z SQL Method User's Guide
but apparently I haven't understood it completely.

To make things definite I will describe a simple case.  Suppose I look
up one author's name.  The Z SQL Method is called search_author.  The
columns it returns include the "id" for each reference listing, the
"type", the "year", and the "title".  I have also created a Z SQL
Method called return_authors that takes a single argument "id" and
returns the names of the authors, one per row, in the correct order
for the publication.  Another Z SQL Method, return_journal, also takes
an "id" number and returns the title of the journal, the volume and
number, the beginning page and the final page of the article.

While I am processing the results of search_author in the DTML method,
I would like to be able to call return_authors and return_journal
directly.  It is not clear to me how I do this.  I had hoped that I
could use a dtml-in tag to call these methods while I was within
another dtml-in but either I am misinterpreting the effect of dtml-in
or I haven't got the sequence right.  What I was trying looked like

<dtml-in search_author size=50 start=query_start>
 ...
        <tr>
          <td><dtml-var year null=""></td>
          <td><dtml-var title null=""></td>
	  <td><dtml-in return_authors start=query_start>
                  <dtml-var name>;
              </dtml-in></td>
              <dtml-in return_journal_info start=query_start>
                  <td><dtml-var title></td>
                  <td><dtml-var vol null=""></td>
                  <td><dtml-var bpg null="">-
                      <dtml-var epg null=""></td>
              </dtml-in>
        </tr>
 ...
</dtml-in>

I was hoping that the <dtml-var id> from within the <dtml-in> loop
would be propagated to a call to return_authors or to return_journal.

I understand that I can use a URL to call the Z SQL Method but I am
hoping I can do it "inline", as it were.

I would appreciate any suggestions.
-- 
Douglas Bates                            bates@stat.wisc.edu
Statistics Department                    608/262-2598
University of Wisconsin - Madison        http://www.stat.wisc.edu/~bates/