[Zope] ZSQL

Tom Deprez tom.deprez@uz.kuleuven.ac.be
Tue, 12 Sep 2000 18:40:25 +0200


Hi,

I use an ZSQLMethod to query a database. In the result report I try to
insert the results of another ZSQLMethod per each record of the first
result report. The problem is that the first record shows the correct
result of the second result, but that the following records all show the
second result report of the first record. Here follow some code snippets: 

This query (contact_lookup) is called from the second report :

select *
from CONTACTPERSON
<dtml-sqlgroup where> 
   <dtml-sqltest ADDRESS.CENTRE_NO column=CONTACTPERSON.CENTRE_NO type=int
optional>
</dtml-sqlgroup>

Here is the second report (tabular_contact_report) :

<dtml-in contact_lookup size=50 start=query_start>

   <dtml-if sequence-start>

      <table border=0>
    
   </dtml-if sequence-start>

        <tr>
          <td><dtml-var CONTACT_NO null=""></td>
          <td><dtml-var CENTRE_NO null=""></td>
          <td><dtml-var CONTACT_NAME></td>
          <td><dtml-var CONTACT_TYPE></td>
          <td><dtml-var PHONE_NO></td>
          <td><dtml-var EMAIL_ADDRESS></td>
        </tr>

   <dtml-if sequence-end>

      </table>
   </dtml-if sequence-end>
<dtml-else>
  None
</dtml-in>

And here is a piece of the first report ( tabular_address_report):

<dtml-in address_lookup size=5 orphan=0 start=query_start>

        <!-- Contactpersons -->
        
             <tr>
              <td colspan=2>
              <table width="100%">
               <tr>
                 <td width="3%">
                 </td>
                 <td bgcolor="#EEEEEE" border="0">
                   <dtml-var CENTRE_NO null="">
                   <small><b>Contactpersons</b></small><BR>
                 </td>
               </tr>
               <tr>
                 <td width=30>
                 </td>
                 <td>
                   <dtml-var tabular_contact_report>           <<<<<<<<<<<
                 </td>
               </tr>
              </table>
              </td> 
             </tr>		      

  
	   </table>

</dtml-in>


It looks like the query is only done with the first request (ie record no
1) and not with the following record. Because the second query returns
always the same results (although I call the query with a different where
parameter). What am I doing wrong?

Tom.