Former Member

### Subtotal on each page for a value

Hello together,

i hope somebody can help me.

I need a subtotal of all value on each page.

I have this structure

Subform1

- Subform_item

--positionnumber

--pricevalue

- Footersubform

--subtotalvalue

i have for example 3 Pages on page one i have 3 positions on page 2 and 3 5 positions with some price value.

Now i will subtotal of page 1 at the end witch containe my 3 pricevalues from page1

Then i will a subtotal on page 2 which containe the subtotal of page 1 and the sum of the pricevalues from page 2-

On Page 3 i also need a subtotal which contain the subtotal from page 1 & 2 and the pricevalue of page 3.

Page1

pricevalue 10,11

pricevalue 10,12

pricevalue 10,13

--subtotal = 30,36

Page2

pricevalue 4,00

pricevalue 4,00

pricevalue 2,00

pricevalue 2,00

pricevalue 2,00

subtotal = 44,36

Page3

pricevalue 1,00

pricevalue 1,00

pricevalue 1,00

pricevalue 1,00

pricevalue 1,00

subtotal = 49,36

I have a footer subform with a field subtotal

and there i try to calculate it.

I try some different examples, but nothing works correct.

This is my last try, but doesn't calculate what i want ðŸ˜Š

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

var total = 0;

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

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

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

}

}

this.rawValue = total;

Thanks in advantage for some help.

Best regards

Florian

Edited by: Florian Martin on Sep 20, 2011 2:38 PM

10|10000 characters needed characters exceeded

• Sep 20, 2011 at 12:45 PM

Hello Florian,

the code which you have written will calculate subtotal of that page.

remove total = 0; just declare the variable.

if you want to initialize the total variable, do it in initialize event

Thanks,

Rakesh.