there's actually two problems here: 1. you might be returning a variable named "newordernum", but to get the result of that ZSQL query you need to refer to the ZSQL method name, not the name of the returned variable. 2. even though it seems your SQL code returns just one variable it actually returns a sequence, just like you have when a whole set of records is returned. here is how you could do it: <dtml-in expr="sqlSelectNextOrderNumber"> <dtml-call expr="REQUEST.set('ordernum', 'newordernum')"> </dtml-in> <dtml-call expr="sqlAddNewClip(ordernum=ordernum)"> or, a little shorter, <dtml-let ordernum="sqlSelectNextOrderNumber()[0].newordernum"> <dtml-call expr="sqlAddNewClip(ordernum=ordernum)"> </dtml-let> jens on 4/6/01 7:28, Gitte Wange at gitte@mmmanager.org wrote:
Hello,
I am trying to insert a result from a sql query into another query
I am selecting 1+max(ordernum) from a table as newordernum and then tries to insert this into a table. I call the sql method like this: <dtml-call expr="sqlAddNewClip(ordernum=newordernum)"> but keeps getting an error: Error Type: NameError Error Value: newordernum
Please .. I have searched the mailinglist archieves for an answer but gets none