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
--
JackHougland - 22 Jul 2008
Answer
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.
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