cancel
Showing results for 
Search instead for 
Did you mean: 

Sum tablerows per page

Former Member
0 Kudos

Hi Adobe Friends,

I've the following situation:

-> One table with 3 columns over multiple pages

-> The target is, to sum all fields of one column PER PAGE and the total on the last page. Content of each field are 2digit numbers

My approach is:

I've build a table with body and footer. Unfortunately I couldn't find a function which replies all rows one page and so on...

Does anybody have another tip for me?How would you release this challenge?

Best

carsten

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

There is an object to do so:

tableCalcs.

In JavaScript (I don't a FormCalc)

Insert tableCalcs into your hierarchy, this a ScirpObject.

And then in the cell you want to display you sub total do on "layout ready" event:

this.rawValue = tableCalcs.obj.Sum("NETWR", xfa.layout.page(this) - 1);

Where NETWR is the value you want to sum, the -1 is needed cause there is a sequence starting at 0 (in script) and another one at 1 (in the layout).

If you want a sub total from start to current:

this.rawValue = tableCalcs.obj.Sum("NETWR", 0 , xfa.layout.page(this) - 1);

Hope it helps.

Matthieu Lefeuvre

Former Member
0 Kudos

Hi Carsten,

You may refer to the Adobe Development center documents on field sum. You will have to write the scripts or the same.

<i>Calculate the field sums

This example demonstrates how to calculate the sums of fields located at different levels of the form hierarchy.

1. Calculate the sum of repeating fields

Script - calculate event of sum

var fields = xfa.resolveNodes("NumericField1[*]"); var total = 0; for (var i=0; i <= fields.length-1; i++) { total = total + fields.item(i).rawValue; } this.rawValue = total;</i>.

There are some 3 usecases provided. Please refer to the same.

Hope this helps.

- anto.