Tags:
create new tag
view all tags

Question

I'm trying to use the ForEachPlugin to generate a list that I can use with the SpreadSheetPlugin. However, it appears as if the CALC tag gets evaluated before the output of the ForEachPlugin is rendered - which doesn't really make any sense.

For example, I have something like this:

%FOR{"include_count" start="23" stop="25" step="1"}% | $include_count %NEXT{"include_count"}% |
%CALC{"$SET(include_revs, $LIST(R1:C1..R1:C999))"}%
%CALC{"$GET(include_revs)"}%

I expect the FOR to generate a table, and the CALC to read that table. However, the CALC behaves as if the table doesn't exist - the include_revs variable gets set to an empty string if this is the first table in the topic, or the contents of the first row of the previous table if not.

Ultimately, what I'm trying to do is to generate a list of the revisions of a page, because I want to extract data from each of those revisions. I have the whole extracting part handled - I just need a list of revisions so that I can iterate through it and generate my tags for each one.

Environment

-- AaronSher - 07 Nov 2006

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

In configure you can specify the evaluation order of plugins with the {PluginsOrder} setting. Make sure the ForEachPlugin executes before the SpreadSheetPlugin.

-- PeterThoeny - 27 Nov 2006

What can be done for Twiki03 on this same problem?

my code is:

%FOREACH{"j" in="%CALC{"$GET(TEST)"}%"}%
   * $j
%NEXT{"j"}%
output:
   * %CALC{"$GET(TEST)"}%

-- JonathanDorling - 19 Oct 2007

Look into the $LISTMAP() function of the SpreadSheetPlugin, that might be all you need.

-- PeterThoeny - 20 Oct 2007

This was a simplified version of my loop. the problem with $LISTMAP(), is that it separates each iteration with a comma which I didn't want. Which is why i use the ForEachPlugin. Do you know away of not having the separating comma?

-- JonathanDorling - 22 Oct 2007

You might also check out FilterPlugin which has FORMATLIST tag which does much the same as ForEachPlugin but is more flexible and has been more developed.

-- LynnwoodBrown - 22 Oct 2007

Do a $LISTJOIN($LISTMAP(...)...) if you want to change the comma separator to another character (such as space.)

-- PeterThoeny - 03 Dec 2007

Change status to:
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2007-12-03 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.