[Zope] Z SQL method - how to get hold of the returning results

Thomas B. Passin tpassin@mitretek.org
Fri, 6 Apr 2001 10:31:58 -0400


Gitte Wange said -

> I have a method that returns a number to be inserted in my database. The
> code looks like this:
> SELECT 1+max(ordernum) AS next_num FROM playlistclips WHERE
> playlistid=<dtml-var showid>
>
> I have tested the code and it works.
> Now I need to insert the next_num in another method and I tried the
> following:
> <dtml-call
>
expr="sqlAddClipToList(slcShowClips=slcShowClips,showid=showid,ordernumber=n
ext_num)">
>
> but I get an NameError:
> Error Value: next_num
>
> I thought that the first method returned a variable named next_num.


The variable "next_num" is known to the query method, so you have to
reference it to that.

Something like this:
The query method is called "query1"

<dtml-in query1>
   <dtml-var next_id>
</dtml-in>

Tom P