Item12541: CALC macro doesn't support mulit-line function calls
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
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