• GeoffreyKing, 2011/02/26 13:55

v1.0 - The sum macro appears to treat negative numbers as positive when summing.

• Jie Pan, 2018/03/19 01:43

Add the following code to line 138 of Macros.CalcGroovy page will solve this problem.
137         else {
138           def value = 0;
139
141
deal with nagative numbers
142           def prev = child2.getPreviousSibling();
143           if (prev && prev.toString().equals("-"))
144             content = "-" + content;
145
146           try {
147            value = Float.parseFloat(content)
148             println "ADDING: \${value} for content \${content}"

• Roman Muntyanu, 2012/01/13 02:42

I experience >100% CPU usage and page loads 20 seconds on following use-case

|=Event date |= Description |=People Involved |=Rate ?/person |=Comments |=Total budget |= Granted
|2012-02 |Team building in the mountains|29|400|Including mobility team|(% style="text-align: right;" %){{calc formula="\$C*\$D" format="0"/}}|
|2012-03|Release pizza party|17|30|Pizza party for finishing maintenance release|(% style="text-align: right;" %){{calc formula="\$C*\$D" format="0"/}}|
|2012-06|Release pizza party|17|30|Pizza party for finishing release in scope of half/year collaboration|(% style="text-align: right;" %){{calc formula="\$C*\$D" format="0"/}}|
|2012-07|Team building in the mountains|29|400|Final release team building |(% style="text-align: right;" %){{calc formula="\$C*\$D" format="0"/}}|
| | | | |(% style="text-align: right;" %)**Grand total**|(% style="text-align: right;" %)**{{sum type="col" format="0 ?"/}}**|
• Charlie M, 2015/02/17 00:45

The Calc Macro worked well in xWiki 6.3.  After upgrading to 6.4.1, the macro stopped working and now displays: "Failed to execute the [groovy] macro. Click on this message for details."

Debugging the CalcGroovy script, it appears that when the script does a .getParent() on the MacroBlock that is coming in, it is returning null.  Previously, it used to return the TableHeader block of the table containing the Macro.

Are there any workarounds for this issue, or plans to make it compatible with 6.4.x?

Thanks

• Ludovic Dubost, 2015/02/18 09:40

I'll try to look at it and see what I can do

• Ludovic Dubost, 2015/02/18 14:50

Yes I confirm what Vincent is saying. It should work again after the core issue is fixed.

• Fabrizio Lungo, 2016/07/25 17:31

The {{sum /}} macro needs a way of filtering rows. I would suggest a parameter of "exclude" which takes a comma separated list of rows to exclude. My current issue is that the row headings also have a number in them and then this gets added to the sum.