SID-01002: BASETOPIC not working as expected
| Status: |
Unanswered |
TWiki version: |
4.2.4 |
Perl version: |
|
| Category: |
CategoryApplications |
Server OS: |
|
Last update: |
15 years ago |
I have a an application where each instance page (
ProjectPage0001,
ProjectPage0002,... ) contains a table and a pair of CALC strings like thi:
%STARTINCLUDE%
|*Username*|*A*|*B*|*C*|*D*|*E*|*F*|
| Bob | 3 | 4 | 4| 3 | 4 | 4 |
| Sally | 4 | 3 | 3| 2 | 4 | 3 |
| Joe | 4 | 2 | 3| 4 | 5 | 2 |
| Sue | 3 | 2 | 3| 4 | 3 | 2 |
%CALC{"$SET(%TOPIC%_Execution, $FORMAT( NUMBER, 2, $EVAL( $AVERAGE(R2:C2..R$ROW():C2) + $AVERAGE(R2:C3..R$ROW():C3) + $AVERAGE(R2:C4..R$ROW():C4) ))) "}%
%CALC{"$SET(%TOPIC%_ValueAdd, $FORMAT( NUMBER, 2, $EVAL( $AVERAGE(R2:C5..R$ROW():C5) + $AVERAGE(R2:C6..R$ROW():C6) +$AVERAGE(R2:C7..R$ROW():C7) ))) "}%
%STOPINCLUDE%
I am including this table and the CALC commands using a SEARCH running on another page,
ProjectTracker.
%SEARCH{"ProjectPage[0-9]+$" scope="topic" type="regex" nonoise="on"
format="$percntINCLUDE{\"$topic\"}$percnt" }%
I'm using SEARCH because I don't know how many Project pages there are, or what they're called. I tried FOREACH driven by SEARCH but it did not handle the INCLUDEs correctly.
The code works.
My question:
why does it work?
Why does
%CALC{"$SET(SID-01002_Execution,... use the search hit name (e.g.
ProjectPage0001) for
%TOPIC%?
Given that I'm
INCLUDE=ing the =CALC into another page,
ProjectTracker, why doesn't
%TOPIC% evaluate to
ProjectTracker?
Why does
%CALC{"$SET(SID-01002_Execution,... produce no result at all? (
%BASETOPIC% should be the included-from topic name, identical to
%TOPIC% if there's no INCLUDE. It shouldn't be
empty.)
Bug? Confusion on my part? Weird order of evaluation thing?
--
VickiBrown - 2010-10-20
Discussion and Answer
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
PeterThoeny - 2011-01-04
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.