I need some help!! 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"> do something true <dtml-else> do something false </dtml-if> </dtml-let> </dtml-in> Since I've written these variables to the screen I know that they're equal, yet they still do the 'do something false' . I hope it's something easy I've overlooked. I didn't know if there were type differences that I need to convert. How do I convert these? Do I need a python script? I'm new to Python so can you help??? Thanks in advance!
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
Hi, I want to do a search on the portal_catalog where a key is an integer....but.....i don't find the solution! If i do <dtml-var numberpumps> I have 32500 If i do <dtml-in "portal_catalog.searchResults(Type='engine', number='numberpumps', review_state='published' )" > ... </dtml-in> I found all the engine-object. The problem is i pass to searchResults '32500' and not 32500 I've tried with <dtml-call REQUEST.set('Type', 'engine')> <dtml-call REQUEST.set('number', numberpumps)> <dtml-in "portal_catalog.searchResults()"> ... </dtml-in> But i've the same results! Pratically number in REQUEST is a string and not an integer!! Do you have some solutions?? Thanks Massimiliano
participants (3)
-
Beaudette, Sheree -
Dieter Maurer -
TrashMan