[Zope-DB] Re: dtml-let variables in sql queries
tillea at rki.de
Thu Nov 23 11:03:47 EST 2006
On Thu, 23 Nov 2006, Jonathan wrote:
>> <params>name nameid
>> SELECT * FROM names
>> WHERE fake = 0
>> <dtml-if name>
>> AND <dtml-sqltest name op=like type=nb>
>> <dtml-if nameid>
>> AND <dtml-sqltest nameid op=eq type=int>
> 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
and this works. The problem is that name which is builded
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.
More information about the Zope-DB