[Zope] Re: Processing ZSQL results

Maik Jablonski maik.jablonski@uni-bielefeld.de
Fri, 11 Apr 2003 18:20:24 +0200


Mark Evans wrote:
> I should know this, but here goes anyway.  I want to retrieve data from a table
> if an id that is submitted from a form is present.  If I submit three id's, but
> only two are present in the table, two results are returned.  I want to trap the
> missing id and display a "no data found" message.  How can I do this?
> 
> <table>
> <dtml-in getResults>
>    <tr><td><dtml-var ID></td</tr>
> <dtml-else>
>   <tr><td>No Data</td></tr>
> </dtml-in>
> 
> This shows only the two results.  The <dtml-else> is triggered only if none of
> the three ID's are present.

My first guess would be something like this:

<dtml-in yourIdList prefix=list>
  <dtml-let result="getResults(id=list_item)">
   <dtml-if result>
     <tr><td><dtml-var ID></td</tr>
   <dtml-else>
    <tr><td>No Data</td></tr>
  </dtml-if>
</dtml-in>

Cheers, Maik