[Zope] dtml-in iteration over a string.split

Curtis Maloney curtis@umd.com.au
Tue, 14 Mar 2000 11:26:20 +1100


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>