cancel
Showing results for 
Search instead for 
Did you mean: 

Sub total in table footer

Former Member
0 Kudos

Hello,

I am creating an Adobe form for SD invoices.

I have a table which contains the list of invoice items. I want to calculate a sub total per page in the table footer.

For example :

PAGE 1

Item1 10,00 euros

Item2 10,00 euros

Item3 10,00 euros

Sub total : 30,00 euros

PAGE 2

Item4 10,00 euros

Item5 13,00 euros

Item6 22,00 euros

Item7 14,00 euros

Sub total : 59,00 euros

PAGE 3

Item8 23,00 euros

Item9 55,00 euros

Sub total : 78,00 euros

How can I calculate this ?

I have found this code on SDN but I don't know if it matches with my problem and I don't know how to use it ....Do you have an idea ?

var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);

var total = 0;

for (var i=0; i <= fields.length-1; i++) {

if (fields.item(i).name == "PRICE") {

total = total + fields.item(i).rawValue;

}

}

this.rawValue = total;

Edited by: Laure VERE on Jul 1, 2010 9:11 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi ,

Search for the function "sum" in formcalc in the "Adobe Livecycle Designer Help". That will solve your problem.

It is something like


var total = sum( TableName.RowName[*].FieldName[*])

Thanks,

Omkar Mirvankar.

OttoGold
Active Contributor
0 Kudos

I f I were you, I would count the totals in backend. In-form scripting is troulesome, affect performance etc etc. If you insist, you can script this out, but I would count that in backend, send the ready-to-use values into the form and only display them there.

Otto