[Zope] More than one condition in<dtml-if>

Angietel angietel@hotmail.com
Mon, 15 Jan 2001 11:14:06 +0800


This is a multi-part message in MIME format.

------=_NextPart_000_0049_01C07EE4.463E38A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


The following is my DTML code, purposely to valid the entry field and =
return the right sql method according to the situation:-

<dtml-if "_['<dtml-var custname>']!=3D""" AND "_['<dtml-var =
custid>']=3D=3D""">=20

      <dtml-in sqlSearchcust3>
  #// if the custid is blank and custname is not blank then will use =
sqlSearch3
 =20
<dtml-elif "_['<dtml-var custid>']!=3D""" AND "_['<dtml-var =
custname>']=3D=3D""">

       <dtml-in sqlSearchcust2>
  #// if the custid is not blank and custname is blank then will use =
sqlSearch2

<dtml-elif "_['<dtml-var custid>']=3D=3D""" AND "_['<dtml-var =
custname>']=3D=3D""">          =20
         =20
       <dtml-in sqlSearchcust>
  #// if the custname is not blank and custid is not blank then will use =
sqlSearch

<dtml-else>

       <dtml-var expr=3D"REQUEST['/Customer/View/searchallcust']">=20
  #// if the custname is blank and custid is blank then will go to view =
a list of customer record.

</dtml-if>


The following is the ZOPE error:-
Unexpected tag, for tag <dtml-elif "_['<dtml-var custid>']=3D=3D""" AND =
"_['<dtml-var custname>']!=3D""">, on line 9 of a


For my sql method syntax are as follow:-

1.sqlSearchcust3

   select *
from customer
<dtml-sqlgroup where>
   <dtml-sqltest custid op=3Dne type=3Dstring>
<dtml-and>
 <dtml-sqltest custname op=3Dlike'%%' type=3Dstring>
</dtml-sqlgroup>

2. sqlSearchcust2

select *
from customer
<dtml-sqlgroup where>
   <dtml-sqltest custid op=3Deq type=3Dstring>
<dtml-and>
 <dtml-sqltest custname op=3Dne type=3Dstring>
</dtml-sqlgroup>

3. sqlSearchcust

select *
from customer
<dtml-sqlgroup where>
   <dtml-sqltest custid op=3Deq type=3Dstring>
<dtml-and>
 <dtml-sqltest custname op=3Dlike'%%' type=3Dstring>
</dtml-sqlgroup>


This is urgent! Please give me some solution, Thanks!

------=_NextPart_000_0049_01C07EE4.463E38A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The following is my DTML code, =
purposely to valid=20
the entry field and return the right sql method according to the=20
situation:-</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-if "_['&lt;dtml-var =
custname&gt;']!=3D"""=20
AND "_['&lt;dtml-var custid&gt;']=3D=3D"""&gt; </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;dtml-in=20
sqlSearchcust3&gt;<BR>&nbsp;&nbsp;#// if the custid is blank and=20
cust</FONT><FONT face=3DArial size=3D2>name&nbsp;is not blank then will =
use=20
sqlSearch3</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; <BR>&lt;dtml-elif =
"_['&lt;dtml-var=20
custid&gt;']!=3D""" AND "_['&lt;dtml-var =
custname&gt;']=3D=3D"""&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;dtml-in=20
sqlSearchcust2&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;#// if the custid is not =
blank and=20
custname is blank then will use sqlSearch2</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-elif "_['&lt;dtml-var =
custid&gt;']=3D=3D"""=20
AND "_['&lt;dtml-var=20
custname&gt;']=3D=3D"""&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;dtml-in=20
sqlSearchcust&gt;<BR></FONT><FONT face=3DArial size=3D2>&nbsp;&nbsp;#// =
if the=20
custname is not blank and custid is not blank then will use=20
sqlSearch<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-else&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;dtml-var=20
expr=3D"REQUEST['/Customer/View/searchallcust']"&gt; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;#// if the=20
custname is&nbsp;blank and custid is&nbsp;blank then will&nbsp;go to =
view a list=20
of customer record.<BR></FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;/dtml-if&gt;<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The following is the ZOPE =
error:-</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Unexpected tag, for tag &lt;dtml-elif=20
"_['&lt;dtml-var custid&gt;']=3D=3D""" AND "_['&lt;dtml-var =
custname&gt;']!=3D"""&gt;,=20
on line 9 of a</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>For my sql method syntax are as=20
follow:-</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>1.sqlSearchcust3</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; select *<BR>from=20
customer<BR>&lt;dtml-sqlgroup where&gt;<BR>&nbsp;&nbsp; &lt;dtml-sqltest =
custid=20
op=3Dne type=3Dstring&gt;<BR>&lt;dtml-and&gt;<BR>&nbsp;&lt;dtml-sqltest =
custname=20
op=3Dlike'%%' type=3Dstring&gt;<BR>&lt;/dtml-sqlgroup&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>2. sqlSearchcust2</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>select *<BR>from =
customer<BR>&lt;dtml-sqlgroup=20
where&gt;<BR>&nbsp;&nbsp; &lt;dtml-sqltest custid op=3Deq=20
type=3Dstring&gt;<BR>&lt;dtml-and&gt;<BR>&nbsp;&lt;dtml-sqltest custname =
op=3Dne=20
type=3Dstring&gt;<BR>&lt;/dtml-sqlgroup&gt;<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>3. sqlSearchcust</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>select *<BR>from =
customer<BR>&lt;dtml-sqlgroup=20
where&gt;<BR>&nbsp;&nbsp; &lt;dtml-sqltest custid op=3Deq=20
type=3Dstring&gt;<BR>&lt;dtml-and&gt;<BR>&nbsp;&lt;dtml-sqltest custname =

op=3Dlike'%%' =
type=3Dstring&gt;<BR>&lt;/dtml-sqlgroup&gt;<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This is urgent! Please give me some =
solution,=20
Thanks!</DIV></FONT></BODY></HTML>

------=_NextPart_000_0049_01C07EE4.463E38A0--