<!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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2><SPAN 
class=792115317-19102004>&nbsp;</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>&nbsp; Hi,<BR><BR>I think 
  that I already made this kind of thing working with a simple :<BR><BR><PRE>&nbsp; &lt;dtml-in "findResults(REQUEST.form)"&gt;
&nbsp; ...
&nbsp; &lt;/dtml-in&gt;
</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
 &lt;dtml-sqlgroup where&gt;
  &lt;dtml-sqltest name="location1" column="site" type="nb" optional&gt;
   &lt;dtml-or&gt;
    &lt;dtml-sqltest name="location2" column="site" type="nb" optional&gt;
   &lt;dtml-or&gt;
    &lt;dtml-sqltest name="location3" column="site" type="nb" optional&gt;
   &lt;dtml-and&gt;
  &lt;dtml-sqlgroup&gt;
   &lt;dtml-sqltest name="usetype1" column="UseType" type="nb" optional&gt;
   &lt;dtml-or&gt;
    &lt;dtml-sqltest name="usetype2" column="UseType" type="nb" optional&gt;
    &lt;dtml-or&gt;
     &lt;dtml-sqltest name="usetype3" column="UseType" type="nb" optional&gt;
   &lt;/dtml-sqlgroup&gt;
  &lt;dtml-and&gt;
   &lt;dtml-sqltest name="active" column="Active_Inactive" type="int"
optional&gt;
&lt;/dtml-sqlgroup&gt;

My form is a combination of checkboxes:
   &lt;form action="resultsPage"&gt;
    &lt;table&gt;
    &lt;tr&gt;
    &lt;td&gt;Select any of the following combinations:&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;table&gt;
    &lt;tr&gt;
    &lt;td&gt;Active:&lt;/td&gt;
    &lt;td&gt;&lt;input type="checkbox" name="active" value="1"
checked="checked"&gt;Active&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;Site:&lt;/td&gt;
    &lt;td&gt;&lt;input type="checkbox" name="location1" value="aus"&gt;Austin &lt;/td&gt;
    &lt;td&gt;&lt;input type="checkbox" name="location2"
value="ca"&gt;California&lt;/td&gt;
    &lt;td&gt;&lt;input type="checkbox" name="location3"
value="mass"&gt;Massachusetts&lt;/td&gt;    
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;UseType:&lt;/td&gt;
    &lt;td&gt;&lt;input type="checkbox" name="usetype1"
value="server"&gt;Server&lt;/td&gt;
    &lt;td&gt;&lt;input type="checkbox" name="usetype2" value="cad"&gt; CAD&lt;/td&gt;
    &lt;td&gt;&lt;input type="checkbox" name="usetype3" value="base"&gt;Base&lt;/td&gt;
    &lt;/tr&gt; 
    &lt;tr&gt;
    &lt;td&gt;&lt;span&gt;&lt;input type="submit" class="submitLink"
value="save"&gt;&lt;/span&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
   &lt;/form&gt;

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.

&lt;dtml-call expr="findResults(location1=location1, ...,
usetype1=usetype1, ...,active=active)"&gt;

 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>