[Zope] Re: Processing ZSQL results

Mark Evans mark.evans.b@bayer.com
Fri, 11 Apr 2003 10:20:43 -0700


Maik, Ed,
Thanks for the help.  It took a bit of tweaking, but basically Maik was right.
So this now works...

<dtml-in mutein_id prefix=list>
   <dtml-if sequence-odd>
      <tr bgcolor='#7685bE'>
   <dtml-else>
      <tr bgcolor='#A5C7CC'>
   </dtml-if>

<dtml-in expr="retrieveOligoData(mutein_id = list_item)">

     <td align='center'><font color='black'><dtml-var mutein_id></font></td>
     <td align='center'><font color='black'><dtml-var molecule></font></td>
     <td align='center'><font color='black'><dtml-var vendor></font></td>
     <td align='center'><font color='black'><dtml-var vendor_id></font></td>
     ......
<dtml-else>
     <td colspan='15'><font color='black'>No data for <dtml-var
list_item></font></td>
</dtml-in>
</tr>
</dtml-in>

One more question though...what does prefix=list do in <dtml-let> and why is it
required? (this doesn't work if that snippet is removed) Why won't sequence-item
work instead of list_item?

Thanks,
Mark



|---------+--------------------------------->
|         |           Maik Jablonski        |
|         |           <maik.jablonski@uni-bi|
|         |           elefeld.de>           |
|         |                                 |
|         |           04/11/2003 09:20 AM   |
|         |                                 |
|---------+--------------------------------->
  >------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                          |
  |       To:       Mark Evans <mark.evans.b@bayer.com>                                                                                      |
  |       cc:                                                                                                                                |
  |       Subject:  Re: Processing ZSQL results                                                                                              |
  >------------------------------------------------------------------------------------------------------------------------------------------|




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