cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
You are here: Foswiki>Tasks Web>Item12541 (05 Jul 2015, GeorgeClark)Edit Attach

Item12541: CALC macro doesn't support mulit-line function calls

pencil
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Extension
Component: SpreadSheetPlugin
Branches:
Reported By: ChunHuang
Waiting For:
Last Change By: GeorgeClark
For example

==%IF( $EMPTY($GET(values)),
$SET(v1, $LISTITEM(1,values))
$SET(v2, $LISTITEM(2,values))
,
$NOP
)==

The above macro will fail. The SpreadSheetPlugin code, where builtin functions are processed recursively (_recurseFunc), uses a regular expression to match all the builtin functions, but it doesn't match multi-line functions. To make it work, just need to add a 's' option to the regular expression.

=  s/\$([A-Z]+)$escToken([0-9]+)\((.*?)$escToken\2\)/_doFunc($1,$3)/geo*s*; =

Someone from DEV team, please make this change.

-- ChunHuang - 05 Jul 2013

Try GluePlugin in the meantime.

-- MichaelDaum - 12 Jul 2013

ChunHuang, I don't really understand the example above. How does %IF process the $... spreadsheet tokens. Doesn't this need to be wrapped in the %CALC macro? Please post a fully working (or failing) example that then works when the change is applied.

The change seems simple enough to do, but I need a valid test case to ensure it doesn't break anything else. It looks like we don't have a specific test case in the SpreadSheetPluginTests for recursive rendering. The tests all pass with the proposed change, but I'd like to add a failing test that then passes after the change.

Michael, do you have an example? -- GeorgeClark - 21 Dec 2014

Actually setting this as waiting for release. This change was picked up .. with some modifications, when I pulled in recent TWiki changes.

-- GeorgeClark - 04 Jan 2015
 

ItemTemplate edit

Summary CALC macro doesn't support mulit-line function calls
ReportedBy ChunHuang
Codebase 1.1.8
SVN Range
AppliesTo Extension
Component SpreadSheetPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r5 - 05 Jul 2015, GeorgeClark - This page was cached on 21 Mar 2018 - 20:11.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License