You are here: Foswiki>Tasks Web>Item10183 (22 Dec 2010, EnrikGuenter)Edit Attach

Item10183: FOR from ForEachPlugin does not work with start="1" stop="1" step="1".

Priority: Normal
Current State: New
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: ForEachPlugin
Reported By: EnrikGuenter
Waiting For:
Last Change By: EnrikGuenter
The most simpel case of an FOR loop does not work (at least not on my system...).

%FOR{"VAR" start="1" stop="1" step="1"}% $VAR %NEXT{"VAR"}%

The topic never opens. Seems to become an endless loop.

This is pretty fatal, when you work with lists in combination with FOR. You never know when a list has only one item and if it has, the topic including this loop crashes.

-- EnrikGuenter - 21 Dec 2010

Hi Enrik, thanks for the bug report. I'm not aware of anybody maintaining ForEachPlugin but maybe somebody will do it.

This is a very old plugin which uses commonTagsHandler for macro expansion. A more reliable way to process lists is use FilterPlugin or Foswiki 1.1's new VarFORMAT macro.

Please check out Support.Faq39 to see how to migrate from ForEachPlugin

-- PaulHarvey - 22 Dec 2010

Yes Paul, you are right, ForEach is old and replacable. But if i don't miss something, varFOR is not!

My case: I need to generate Lines for the EasyTimelinePlugin. A valid line looks like:

from:date till:date color:string text:string

I don't know how many items i have in advance. The dates, text and colors are a result from ActionTrackerPlugin and are each written into a list.

So i have 4 Lists: from_list , till_list , color_list , text_list. Currently, i'm using a nested code like this:

FOR{every item}

from:CALC{$LISTITEM(itemnumber,from_list)} till:CALC{$LISTITEM(itemnumber,till_list)} color:CALC{$LISTITEM(itemnumber,color_list)} text:CALC{$LISTITEM(itemnumber,text_list)}


I don't see a way to do this elegantly with either FORMATLIST or varFORMAT. Is there a way?


-- EnrikGuenter - 22 Dec 2010

I'm so sorry! Didn't see the $index token for type="string" operations. With this token, it's equivalent! Sorry again and thank you very much!

-- EnrikGuenter - 22 Dec 2010

ItemTemplate edit

Summary FOR from ForEachPlugin does not work with start="1" stop="1" step="1".
ReportedBy EnrikGuenter
Codebase 1.1.2
SVN Range
AppliesTo Extension
Component ForEachPlugin
Priority Normal
CurrentState New
Checkins ForEachPlugin:6d404bf608c7
TargetRelease n/a
ReleasedIn n/a
Topic revision: r4 - 22 Dec 2010, EnrikGuenter - This page was cached on 18 Sep 2021 - 06:41.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy