<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=792115317-19102004>Thanks, this idea worked perfectly for me.
</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=792115317-19102004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=792115317-19102004>-Laura</SPAN></FONT></DIV><SPAN
class=792115317-19102004></SPAN>
<DIV></DIV>
<DIV><FONT face=Tahoma size=2><SPAN
class=792115317-19102004></SPAN></FONT> </DIV>
<DIV><FONT face=Tahoma size=2><SPAN
class=792115317-19102004> </SPAN>-----Original Message-----<BR><B>From:</B>
Thierry FLORAC [mailto:tflorac@onf.fr] <BR><B>Sent:</B> Tuesday, October 19,
2004 11:19 AM<BR><B>To:</B> Laura McCord<BR><B>Cc:</B>
zope@zope.org<BR><B>Subject:</B> Re: [Zope] Calling a zsql with optional
fields<BR><BR></DIV></FONT>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"><BR> Hi,<BR><BR>I think
that I already made this kind of thing working with a simple :<BR><BR><PRE> <dtml-in "findResults(REQUEST.form)">
...
</dtml-in>
</PRE>(if "findResults" is the name of your ZSQLMethod
component...)<BR><BR><BR>Thierry<BR><BR><BR><BR>On Tue, 2004-10-19 at 18:11,
Laura McCord wrote:
<BLOCKQUOTE TYPE="CITE"><PRE><FONT color=#40a3c5><I>Ok. I redesigned my zsql method to be much simpler:
select * from host
<dtml-sqlgroup where>
<dtml-sqltest name="location1" column="site" type="nb" optional>
<dtml-or>
<dtml-sqltest name="location2" column="site" type="nb" optional>
<dtml-or>
<dtml-sqltest name="location3" column="site" type="nb" optional>
<dtml-and>
<dtml-sqlgroup>
<dtml-sqltest name="usetype1" column="UseType" type="nb" optional>
<dtml-or>
<dtml-sqltest name="usetype2" column="UseType" type="nb" optional>
<dtml-or>
<dtml-sqltest name="usetype3" column="UseType" type="nb" optional>
</dtml-sqlgroup>
<dtml-and>
<dtml-sqltest name="active" column="Active_Inactive" type="int"
optional>
</dtml-sqlgroup>
My form is a combination of checkboxes:
<form action="resultsPage">
<table>
<tr>
<td>Select any of the following combinations:</td>
</tr>
</table>
<table>
<tr>
<td>Active:</td>
<td><input type="checkbox" name="active" value="1"
checked="checked">Active</td>
</tr>
<tr>
<td>Site:</td>
<td><input type="checkbox" name="location1" value="aus">Austin </td>
<td><input type="checkbox" name="location2"
value="ca">California</td>
<td><input type="checkbox" name="location3"
value="mass">Massachusetts</td>
</tr>
<tr>
<td>UseType:</td>
<td><input type="checkbox" name="usetype1"
value="server">Server</td>
<td><input type="checkbox" name="usetype2" value="cad"> CAD</td>
<td><input type="checkbox" name="usetype3" value="base">Base</td>
</tr>
<tr>
<td><span><input type="submit" class="submitLink"
value="save"></span></td>
</tr>
</table>
</form>
The only problem I am having is bridging the two in order to get my
results. I have a dtml method that I am trying to process the zsql
method but I don't think I am doing it correctly.
<dtml-call expr="findResults(location1=location1, ...,
usetype1=usetype1, ...,active=active)">
But, with the above if location2 or any of the boxes are not selected I
am getting an error that they are not defined. How do I correct this
problem?
Thanks You.
_______________________________________________
Zope maillist - Zope@zope.org</FONT>
<A href="http://mail.zope.org/mailman/listinfo/zope"><U>http://mail.zope.org/mailman/listinfo/zope</U></A>
<FONT color=#40a3c5>** No cross posts or HTML encoding! **
(Related lists -
</FONT><A href="http://mail.zope.org/mailman/listinfo/zope-announce"><U>http://mail.zope.org/mailman/listinfo/zope-announce</U></A>
<FONT color=#40a3c5> </FONT><A href="http://mail.zope.org/mailman/listinfo/zope-dev"><U>http://mail.zope.org/mailman/listinfo/zope-dev</U></A><FONT color=#40a3c5> )</I></FONT></PRE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>