dtml-in iteration over a string.split
I've put the following in a SQL method, but can't figure out where the count ends up... <dtml-in "_.string.split(tool_id)"> tool_id is a string (like 'EXP01 EXP02 EXP03'). For my normal DB activities I use count-attribute name for the count total, but I can't seem to find out where the count is stored in this example... I tried getting the key with sequence-key, which returned 1, but count-1 returns 0. I've solved this already with <dtml-if expr="_.len(_.string.split(tool_id)) > 1"> but this bothers me.... I know theres a better way!
Greetings, On Tue, 14 Mar 2000, Daniel.Weber@SEMATECH.Org wrote:
I've put the following in a SQL method, but can't figure out where the count ends up...
<dtml-in "_.string.split(tool_id)">
tool_id is a string (like 'EXP01 EXP02 EXP03'). For my normal DB activities I use count-attribute name for the count total, but I can't seem to find out where the count is stored in this example... I tried getting the key with sequence-key, which returned 1, but count-1 returns 0.
if you want the size of the list, just use sequence-size
I've solved this already with <dtml-if expr="_.len(_.string.split(tool_id)) > 1">
from this, it looks as though you want to check if you're at the start of the list, in which case you can test sequence-start <dtml-unless sequence-start> things here don't get rendered on first iteration of loop </dtml-unless>
but this bothers me.... I know theres a better way!
yes, there is. Unless i've totally misunderstood your quandry. (o8 for further information, check the DTML guide, specifically: http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.8.2.html -- Have a better one, Curtis. <dtml-var standard_work_disclaimer>
On Tue, 14 Mar 2000, Jonothan Farr wrote:
if you want the size of the list, just use sequence-size
I cannot find reference to sequence-size anywhere in the DTML documentation. Where did you learn about this variable?
You're absolutely correct. It doesn't appear to be in the documentation. The closest I could find was an offhand reference to 'sequence-length' in the ZQR. I just assumed that since 'previous-sequence-size' and 'next-sequence-size' existed, sequence-size would also. Did it, in fact, work?
--jfarr
-- Have a better one, Curtis. <dtml-var standard_work_disclaimer>
participants (3)
-
Curtis Maloney -
Daniel.Weber@SEMATECH.Org -
Jonothan Farr