Tags:
create new tag
, view all tags

Question

It seems that a for loop variable is not being properly handled by a spread sheet plugin call that occurs within a for loop.

Example:

%FOR{"c" start="2" stop="%CALC{"$GET(lastRowIndex)"}%" step="1"}% <br>
                   row $c: $percntCALC{"$T(R$c:C3)"}$percnt <br>
%NEXT{"c"}%

FYI...there is no problem resolving the lastRowIndex variable. The problem is when %CALC{"$T(R$c:C3)"}% is called, the $c is not properly handled/resolved.

This loop will just print: row 2: row 3: row 4: row 5: row 6: row 7: row 8: row 9: row 10: row 11: row 12: row 13: row 14: row 15: row 16:

For the sake of experimenting I tried making this function call within the loop: %CALC{"$T(R4:C3)"}% and the loop printed the contents of row 4 & column 3 fourteen times.

Any suggestions for getting around this problem?

Environment

TWiki version: TWikiRelease04x00x01
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Solaris 8
Web server: Apache 1.3
Perl version: Perl 5.8.0
Client OS: Windows XP SP2
Web Browser: Mozilla Firefox 2.0.0.16
Categories: Statistics, Missing functionality, Performance, Documentation, Plugins

-- JackHougland - 22 Jul 2008

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

It's probably expanding the spreadsheet calc first. To get the FOR expanded first, go into configure:

{PluginsOrder} = ForEachPlugin,SpreadSheetPlugin

Note that this will affect the behaviour of any topic that uses those plugins.

Aside: you can often do without the FOR loop by using the LIST functions.

-- SeanCMorgan - 23 Jul 2008

Seems to be answered. Closing this question after more than 30 days of inactivity. Feel free to re-open if needed.

-- PeterThoeny - 02 Sep 2008

 
Change status to:
Topic revision: r3 - 2008-09-02 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.