[Zope] querying status in zsql

Rik Hoekstra rik.hoekstra@inghist.nl
Fri, 10 Nov 2000 17:24:08 +0100


>
> I have a processing script that takes emails and puts them into a table.
> I bring up a table for confirmation and then submit the whole thing by a
> iterative item:records zsql method.
>
> My problem is that the table requires a unique primary key and quite
> regularly there duplicates. So ofcourse it falls over with the expected
> error. I have tried in the zsql method encapsulating the sql with a
> <dtml-if "checkforexistantrecord"> and then at the bottom of the zsql
> loop I commit so make sure the second time around, the data is checked.
> This does not seem to work.
>
> So what im left with wondering is, if I can query in the zsql method:
> if error, then exit or go somewhere else
>
> Is this possible?

yes, this is possible. If I understand your question at least. BTW This is
untested, but I have used something similar before

mailid is the input field/variable for your method

<dtml-in emailitems>
   <dtml-in checkexistant_error(mailid=mailid)> (if this is another zsql
method)
        <dtml-if sequence-start>
               skip or do something else
         <dtml-else>
                upload your email. You may want to call another Zsql method
for this
         </dtml-if>
    </dtml-in>
<dtml-in>




> sorry to be very vague. The conundrum is the fact that
> the zsql method it an item loop in its own, so i cannot seem to use an
> if statement because it doesnt iterate by the normal <dtml-in> route....
>
> Any advice?


hth

Rik