[Zope] re: Length of results set

Ken ken@p11.org
Thu, 16 Jan 2003 21:33:39 +0100 (CET)


Dylan Reinhardt wrote:

> Try:
> 
> <dtml-call "REQUEST.set('my_langs', [])">
> <dtml-let langShort="lang[2:]">
> <dtml-in objectValues>
> <dtml-if "id==langShort">
> <dtml-call "my_langs.append(langShort)">
> </dtml-if>
> </dtml-in>
> </dtml-let>

> You found <dtml-var "_.len(my_langs)"> matches: <UL>
> <dtml-in my_langs>
> <LI><dtml-var sequence-item></LI>
> </dtml-in>
> </UL>
> 
> Does *that* do it?

Yes! Well, almost: it had to be
<dtml-call "REQUEST['my_langs'].append(langShort)"> etc
for some reason...

To anyone who got confused, of course, I was using Beno's example which was representative of something I needed.. Using append as a counter was new to me, thanks for that!

Ken