<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2668" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>You cannot embed one dtml tag within another dtml 
tag.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>A couple of possible work-arounds:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>1) use a python script to return the values you 
need</FONT></DIV>
<DIV><FONT face=Arial size=2>2) create a python script which 'builds' a new dtml 
script and then execute the new script (ugly, but it works - not very efficient, 
so how often you run this will be a factor).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>hth</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Jonathan</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=fairwinds@eastlink.ca href="mailto:fairwinds@eastlink.ca">David 
  Pratt</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=zope@zope.org 
  href="mailto:zope@zope.org">zope@zope.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, July 08, 2005 1:08 PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [Zope] DTML bug with database 
  arrays in sqltest</DIV>
  <DIV><BR></DIV>I am using arrays in Postgres. I need to be able to compare a 
  string value in a specific position of a text array field (text[] is a field 
  type in Postgres) against a variable(argument) I am passing to my query. I am 
  only using parts of the query to illustrate the problem as the rest is 
  irrelevant. I replaced the table, field names and arguments with names that 
  might make this more understandable.<BR><BR>First. I am finding arrays work 
  fine with select statements in DTML when you use sqlvar to request a specific 
  value from the array. <BR><BR>ie.<BR><BR>SELECT<BR>a_table.an_array_field[<?fontfamily><?param Lucida Grande>&lt;dtml-sqlvar 
  some_value type="int"&gt;][2]<BR>FROM ....(rest of 
  query)<?/fontfamily><BR><BR>But when you put them inside a sqltest tag for 
  evaluating values it throws an error because DTML cannot parse 
  it.<BR><BR>ie.<BR><BR>SELECT ...<BR>blah blah.....<BR>&lt;dtml-and&gt;<BR><?fontfamily><?param Lucida Grande>&lt;dtml-sqltest 
  column=a_table.an_array_field[&lt;dtml-sqlvar an_array_key type="int"&gt;][2] 
  name=a_title_var op="eq" type="string" optional&gt;<BR>..... (rest of 
  query)<BR><?/fontfamily><BR>The issue is how to test against these values when 
  DTML cannot parse them? My raw sql query works fine giving me the desired 
  results but I cannot construct the statement in DTML.<BR><BR>The part of the 
  query that throws the error is the dtml-sqltest tag (it gives a parsing 
  error). 
  ie.<BR><BR>&lt;dtml-and&gt;<BR><?fontfamily><?param Lucida Grande>&lt;dtml-sqltest 
  column=a_db.an_array_field[&lt;dtml-sqlvar an_array_key type="int"&gt;][2] 
  name=a_title op="eq" type="string" optional&gt;<BR><BR>should translate 
  to:<BR><BR>AND<BR>a_table.an_array_field[1][2] = 'This is a title' (This is a 
  valid expression for Postgres)<BR><BR>where an_array_key is a variable with 
  value of 1 and a_title is variable with a value of 'This is a title' 
  <BR><BR>The above would give an invalid attribute name error for the 
  an_array_key (variable/argument).<BR><?/fontfamily><BR>Is this a bug or is 
  there something else I ought to be doing? If this is a limitation of DTML, is 
  there a work around?<BR><BR>Regards,<BR>David<?fontfamily><?param Lucida Grande> 
  <BR><BR><BR><BR><?/fontfamily>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Zope maillist&nbsp; 
  -&nbsp; 
  Zope@zope.org<BR>http://mail.zope.org/mailman/listinfo/zope<BR>**&nbsp;&nbsp; 
  No cross posts or HTML encoding!&nbsp; **<BR>(Related lists - 
  <BR>&nbsp;http://mail.zope.org/mailman/listinfo/zope-announce<BR>&nbsp;http://mail.zope.org/mailman/listinfo/zope-dev 
  )<BR></BLOCKQUOTE></BODY></HTML>