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

Daniel.Weber@SEMATECH.Org Daniel.Weber@SEMATECH.Org
Tue, 14 Mar 2000 07:48:08 -0600


> 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 can't get this to work at all:
<dtml-if "sequence-size > 1">
zope complains about not being able to find 'sequence'.  I had solved this issue
before with a let tag <dtml-let size=sequence-size>, but it seems very wasteful
and adds a lot of syntax overhead to the code.  How can I access the sequence
variable in an expression?

> > 
> 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
Actually, I'm checking to see if I've got multiple elements.  If I do, then I
use IN () in my DB query, else I put in =.  When I split the string, I don't
know if I have multiple items.