[Zope] Comparing variables

Dieter Maurer dieter@handshake.de
Tue, 8 Jan 2002 23:03:05 +0100


Beaudette, Sheree writes:
 > I have a form that sets the variable copyitem, a number from 1 to ... (an
 > integer)
 > 
 > <input type="text" name="copyitem">
 > 
 > Once I submit the form
 > 
 > I want copyitem to be compared with a sequence-number from a SQL query, code
 > as follows
 > 
 > <dtml-in clsqGetNotes>
 > <dtml-let seqnum=sequence-number>
 >   <dtml-if "seqnum == copyitem">
Unless you do something special, all request variables are strings.
"sequence-number" on the other hand are integers. And the integer 1
is not equal to the string '1'. You need to coerce either the integer
or the string. Try:

   <dtml-if "seqnum == _.int(copyitem)">

or

   <dtml-if "`seqnun` == copyitem">


Dieter