Hi all, 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. Thanks, Mark Evans
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
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
participants (3)
-
Ed Leafe -
Maik Jablonski -
Mark Evans