[Zope] Simple question? Increment by 1!

Michael Billimoria 2blaze@optushome.com.au
Sat, 09 Jun 2001 22:14:58 +1000


Hi there,

I hope this is going to the right forum - if not, my apologies. :-)

I'm hoping that this is a fairly simple question to be answered - I'm
fairly new to Zope and am only a novice programmer at best :-)

I am running a MySQL query (Find_Last_Callnote) which looks like this - 

select max(CALLNOTENUM) from callnote
where JOBID = '<dtml-sqlvar JobID type="int">'

so basically I'm trying to get the maximum value in field CALLNOTENUM
given a specific jobID.

This all works fine however what I want to do then is increment the last
CALLNOTENUM by 1 and then add a new callnote with that number

So my DTML Method looks something like this except I have left out the
bit where I would have to increment the number by 1 and then call the
update function - 

<dtml-in Find_Last_Callnote>

<dtml-if max(CALLNOTENUM)>
   <p>This is not the first callnote</p>
   ?????? WHAT DO I DO HERE ??????
<dtml-else>
   <p>This is the first callnote</p>
   <dtml-call Insert_First_Callnote>
</dtml-if>

</dtml-in>

Unfortunately when using SQL functions such as 'max' the dtml variables
assigned come back which Brackets in them - this means that if I try to
do a <dtml-if expr="max(CALLNOTENUM etc.)"> the dtml is not interpreted
correctly and results in an error.

I assume I might have write a python script to pull this off, is that
true? and if so how would I do that. Of course I'm probably trying to do
this the hard way, so if there is an easier way could you let me know?
:-)

Many thanks,

Michael