Thanks for your help, but I still do not get it (although I did do some of the "homework" :-)). This is my Zsql method's DTML: select * from presidents where <dtml-sqltest name type=string multiple> I am using it just from Zope's "test" tab. How do I input a list of names ? Where should I add the :list suffix ? I have read the Zope book and DTML reference, but yet I do not understand. Thanks. Fabrizio C. -----Messaggio Originale----- Da: Dieter Maurer <dieter@handshake.de> A: Fabrizio <facelle@libero.it> Cc: <zope@zope.org> Data invio: lunedì 16 luglio 2001 20.16 Oggetto: Re: [Zope] ZSQL "OR" search help
Fabrizio writes:
How can I perform a "OR" search on a SQL database field using a web form ? ... Thanks for your help. Hmm....
What have you already looked at?
* an SQL description? * the DTML reference? * the Zope book? * the HTML spec or a book about HTML? * URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html
I think, you should look at some of them. I would call that doing your homework...
Some hints:
* you need to decide how to collect the OR operands on the web page. Options:
- a multiple selection (be sure to add ":list" to the select name) - a textarea with a ":lines" suffix - an input field with the ':tokens' suffix - a string with 'OR' operators
With the exception of the last option, all will give you a list. For the last option, you must parse the string into a list. If things are simple, you could use "string.split".
* you now have a list of search terms. The best way to use it in the SQL statement would probably be "dtml-sqltest multiple". See the DTML reference for details
* you will need a Z SQL Method and a Database adapter. Thinks, you learn in the Zope book.
Be seeing you after your homework with more concrete questions....
Dieter