[Zope] Processing ZSQL results

Ed Leafe ed@leafe.com
Fri, 11 Apr 2003 12:50:49 -0400


On Friday, April 11, 2003, at 12:13  PM, 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.

	Don't loop on the results; instead, loop on the list of IDs you have. 
You can search the results for the matching record, and display your 
'else' if there isn't any match.

      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://opentech.leafe.com