SID-01596: Greedy evaluation of expressions
| Status: |
Answered |
TWiki version: |
5.0.2 |
Perl version: |
5.8.8 |
| Category: |
SpreadSheetPlugin |
Server OS: |
RedHat Linux, kernel 2.6.18 |
Last update: |
13 years ago |
I am attempting to use the
SpreadSheetPlugin to perform a textual transformation and set the result.
For a topic named 1-3-6-1-4
- Set OID = %CALC{"$SUBSTITUTE(%TOPIC%, -, .)"}%
I then want to use the OID variable at various locations in the topic. In general this seems to be working, however if OID is included in a pre block then it becomes apparent that the CALC is being evaluated lazily because TOPIC is substituted but the equation remains.
| Use |
Result |
| %OID% |
1.3.6.1.4 |
| <pre>%OID%</pre> |
%CALC{"$SUBSTITUTE(1-3-6-1-4, -, .)"}% |

Incidentally, the literal tag expands the CALC properly, but it messes up the rest of the text I have embedded with the pre.
Is there a way to force the evaluation of the expression so that the variable OID is set with the result instead of the expression?
--
JoshuaTharp - 2012-11-30
Discussion and Answer
Install the latest
SpreadSheetPlugin and use CALCULATE instead of CALC.
--
PeterThoeny - 2012-11-30
Thanks Peter. Please don't take this the wrong way, but I'm a little bummed you were so fast to answer my question as I had just discovered the answer myself!
--
JoshuaTharp - 2012-11-30
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.