RE: [Zope] Grabbing specific indexes from an #in
-----Original Message----- From: craigv@jps.net [mailto:craigv@jps.net] Sent: Monday, July 19, 1999 3:23 PM To: zope@zope.org Subject: [Zope] Grabbing specific indexes from an #in
I am trying to find a way to grab a specific index from an #in. I would like to use this much like an array in which I could ask for the object at index [i]. Is there a way to grab specific indexes from an #in without iterating through the entire list of objects?
No need to use #in if you just want one item: <!--#var "sequence[index]"--> you can slice too: <!--#in "sequence[5:]"--> ... <!--#/in--> gives you the fifth to the last element. Note the quotes. This is an evaluation of an expression. -Michel -Michel
Thanks,
--Craig
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
Hope I don't seem dense, but could I get a bit more clarification? Right now I am iterating through like this: <!--#in "objectValues('Folder')" sort=sort_code--> ... and pulling out certain properties of each folder: <!--#var "_['some_property']"--> How do I achieve the same goal while picking the folder at a specific sequence? For example, I want to display some properties of the folders at indexes 2, 5, and 7 without iterating through all of the folders. Thanks in advance for your help. --Craig
I am trying to find a way to grab a specific index from an #in. I would like to use this much like an array in which I could ask for the object at index [i]. Is there a way to grab specific indexes from an #in without iterating through the entire list of objects?
No need to use #in if you just want one item:
<!--#var "sequence[index]"-->
you can slice too:
<!--#in "sequence[5:]"--> ... <!--#/in-->
gives you the fifth to the last element. Note the quotes. This is an evaluation of an expression.
-Michel
-Michel
Thanks,
--Craig
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
craigv@jps.net -
Michel Pelletier