re: Length of results set
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
At 12:33 PM 1/16/2003, Ken wrote:
Does *that* do it?
Yes! Well, almost: it had to be <dtml-call "REQUEST['my_langs'].append(langShort)"> etc for some reason...
Odd... can't imagine why *that* would be. Once you've stuffed 'my_langs' in the REQUEST, it should be easy enough to find. I just verified the following (v. 2.5.1): <dtml-call "REQUEST.set('my_source', [1,2,3,4])"> <dtml-call "REQUEST.set('my_target', [])"> <dtml-in my_source prefix="source"> <dtml-call "my_target.append(source_item)"> </dtml-in> <dtml-var "_.len(my_target)"> : <dtml-var my_target> which returns 4 : [1, 2, 3, 4] as expected. REQUEST shouldn't normally be required to use append()... but hey, if it works, who cares, right? :-) Dylan
participants (2)
-
Dylan Reinhardt -
Ken