RE: [Zope] dtml-in iteration over a string.split
This is untested but it should do the trick:)
<dtml-if "_.int(sequence-size) > 1">
This gives a key error as well. To summarize what I'm trying to do: <dtml-in "_.string.split(string_with_1_or_more_words)"> <dtml-if "we_have_>_1_items"> we have <dtml-var what_is_this_var?> items <dtml-else> we have only 1 item </dtml-if> I can do the > 1 check with <dtml-if "_.len(_.string.split(string)) > 1">, but it seems I should be able to get to a count-nnn var inside. Since I'm not using a SQL statement, I don't know what the variable is named. sequence-size give a name error wherever I use it (from the test screen of a SQL query). <dtml-var sequence-key> returns the fist digit of the word. So, the question is, in the statement: <dtml-in "_.string.split('item_1 item_2 item_3')> what will the count-nnn variable be named?
Daniel.Weber@SEMATECH.Org wrote:
This is untested but it should do the trick:)
<dtml-if "_.int(sequence-size) > 1">
This gives a key error as well. To summarize what I'm trying to do:
<dtml-in "_.string.split(string_with_1_or_more_words)"> <dtml-if "we_have_>_1_items"> we have <dtml-var what_is_this_var?> items <dtml-else> we have only 1 item </dtml-if>
<dtml-let items="_.string.split(string_with_1_or_more_words)"> <dtml-let numitems="_.len(items) > 1"> <dtml-if "numitems > 1"> we have &dtml-numitems; items <dtml-else> we have one item </dtml-if></dtml-let></dtml-let> Or you can access sequence-size as _['sequence-size']: <dtml-if "_.int(_['sequence-size']) > 1"> -- Itamar S.T. itamars@ibm.net
participants (2)
-
Daniel.Weber@SEMATECH.Org -
Itamar Shtull-Trauring