Hello everyone,
I need your help with this issue.
I need a subtotal value at the end of a table. This table is inserted in a subform and could be shown more than one time in a page.
My requierement is a subtotal for each subform. Now I get this subtotal for each subform, but the value is not right because is the value of all the lines of the page, and I want the sum of the values only of each table.
Example.
Now
Page 1.
Subform1
Table 1 1
2
3
Subtotal 20 (Sum of all the lines of the page)
Table 2 10
4
Subtotal 20(Sum of all the lines of the page)
What I want is:
Page 1.
Subform1
Table 1 1
2
3
Subtotal 6 (Sum of all the lines of the page)
Table 2 10
4
Subtotal 14(Sum of all the lines of the page)
In the script code, I have write the next:
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_DIFFERENCE_TOTAL") {
total = total + fields.item(i).rawValue;
}
}
this.rawValue = total;
Could you help me please?
Thank you very much.