[Zope-DB] Re: dtml-let variables in sql queries
Andreas Tille
tillea at rki.de
Thu Nov 23 11:03:47 EST 2006
On Thu, 23 Nov 2006, Jonathan wrote:
>> <params>name nameid
>>
>> </params>
>> SELECT * FROM names
>> WHERE fake = 0
>> <dtml-if name>
>> AND <dtml-sqltest name op=like type=nb>
>> </dtml-if>
>> <dtml-if nameid>
>> AND <dtml-sqltest nameid op=eq type=int>
>> </dtml-if>
>
> First off, i would highly recommend using python scripts instead of DTML for
> the kind of processing you have described.
You are right here and I would definitely prefer Python scripts. The
problem is that I'm using the Formulator Product and despite there are
descriptions how to use it with Python scripts I failed while it was
very straigtforeward to use DTML (in fact, this is the only part of
my application in DTML). I just stripped down the application to a
very simple example and avoided Formulator magic which is obviousely
not the source of the problem.
> That said, you have not described the GetCases method.
I forgot to mention the name. It is the code snipped above.
> If GetCases is the
> name of your SQL method, then you need to pass in the parameter 'nameid'
Well, nameid is not explicitely passed but taken from the parent
out of
<dtml-let nameid="REQUEST.form['nameid']">
and this works. The problem is that name which is builded
out of
<dtml-let namepart="REQUEST.form['namepart']">
Namepart = <dtml-var namepart><br />
<dtml-let name="namepart + '%'">
is ignored by the SQL method and I fail to see the difference.
The <dtml-if name> seems to be false in any case.
Kind regards
Andreas.
--
http://fam-tille.de
More information about the Zope-DB
mailing list