In the call to the ZSQL Method, in doclang=doclang the first doclang is the name of the variable declared in the ZSQL method and the second doclang is the content of the variable with that name in the DTML Method. So if you put the second doclang in quotes you pas the string 'doclang' rather than the content of the doclang variable. That explains why the latter does not cause an error but returns no results. It is often less confusing to use different names for the argument name and value, for example DocLangField=testLanguage (or docLangField='English'). The error value you have quoted (Error Value: 'DOCLANG':) suggests the problem may be case sensitivity. Check that the case of the Database Field that you are testing matches the case of the name you are passing to the query. One gotcha to be aware of is that some databases accept field names in any case but return field names in upper case. For example, you may be able to do this: select * from table where doclang is not null but find that the return field name is DOCLANG. Not sure if this is relevant in this case. Cliff Ivan Stout wrote:
Dieter,
Thanks, it is a Z SQL method . . . I will get rid of the positional place holders.
Cliff,
Thanks for the response.
I did the following:
DTML METHOD file:
<html> <dtml-var name><br> <dtml-var doclang> <form action="parsegettranslation.py" method="get"> <dtml-in expr="gettransdoc(name=name,doclang=doclang)"> #changed here <br> <dtml-var ordering> <dtml-var content>
gettransdoc Z SQL Method file:
(ARGUMENTS:name doclang)
select * from document where name=<dtml-sqlvar name type=string> and doclang=<dtml-sqlvar doclang type=string>
This is what I get:
"Error Type: NameError Error Value: 'DOCLANG': ambiguous or unknown attribute"
However, if I add a single quote to the DTML Method, like this: <dtml-in expr="gettransdoc(name='name',doclang='doclang')">
I do not get an error, but I do not get my query results either . . . Are the single quotes getting literally passed to the query or something?
On Thu, 10 Mar 2005 22:11:58 +0000, Cliff Ford <Cliff.Ford@ed.ac.uk> wrote:
It is not clear to me why you would pass None parameters to a select query. Typically your query would have named arguments (name and doclang) like this:
select * from yourTable where name=<dtml-sqlvar name type=string> and doclang=<dtml-sqlvar doclang type=string>
Leave out the last line if you don't want to select and doclang.
Then call the query like this:
<dtml-in expr="gettransdoc(name=name,doclang=doclang)"> <dtml-var ordering> <dtml-var content><br> </dtml-in>
Cliff
Ivan Stout wrote:
Greetings. I am trying to create an open source communal translation zope product thingy and have run into a snag. I had everything working, but then I realized that I needed to distinguish between what the language that the original document bein translated was in, which required passing an additional paramater to my query to gadfly. Well, this supposedly "broke the paramater chain" requiring me to explicitly add positional paramaters. The problem is, though I no longer get an error, no results are returned from my table. The paramaters are filtering the query, so I believe that my values are getting altered in some way that is causing them to not match anything. Here is what I suspect is causing me trouble . . .(the "----------------->" part):
<dtml-var name><br> <dtml-var doclang> <form action="parsegettranslation.py" method="get"> -----------> <dtml-in expr="gettransdoc(_.None,_,name='name',doclang='doclang')"> <br> <dtml-var ordering> <dtml-var content> <br>
Thanks! _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )