Tags:
create new tag
view all tags

SID-01596: Greedy evaluation of expressions

Status: Answered 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, -, .)"}%

IDEA! 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! wink

-- JoshuaTharp - 2012-11-30

      Change status to:
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.
SupportForm
Status Answered
Title Greedy evaluation of expressions
SupportCategory SpreadSheetPlugin
TWiki version 5.0.2
Server OS RedHat Linux, kernel 2.6.18
Web server Apache 2.2.3
Perl version 5.8.8
Browser & version Firefox 16.0.2
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2012-11-30 - JoshuaTharp
 
  • 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.