cancel
Showing results for 
Search instead for 
Did you mean: 

Adobe Help required:subtotal of amount per page in Adobe forms

Former Member
0 Kudos

Hello everyone,

I have the following requirement:

If i have 12 items in my i_item table:

Page 1 --> 8 items fit

calculate and display subtotal of field amount(WRBTR) of the 8 items at end of page 1

Page 2 --> remaining 4items fit

display the subtotal displayed on the on the previous page as first record of page

display remaining 4 items

calculate and display subtotal of field amount(WRBTR) of these 4 items at end of page 2

In last page calculate and display grand total based on the subtotals

In my table i_item (DATA section) i added a footer section and placed the code SUM(I_ITEM.DATA[].WRBTR[]) in the subtotal field, but it gave the grand total.

As per SDN i changed the code to SUM(WRBTR[]) but nothing is displayed on the form. I also tried SUM(DATA[].WRBTR[*]) and i obtained the valu

Settings used: Formcalc , Client, Calculate, Calculation Script

i also tried the following two Javascript code with the following settings

Javascript, Client, Events with Scripts, Calculation Script

in the footer row and i obtained nothing on screen

first code used:

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

var total = 0;

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

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

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

}

}

this.rawValue = total;

second code used:

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 == "WRBTR")

{

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

}

}

this.rawValue = total;

kindly provide help.

thanks&regards;

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Devi,

Try with this code.

1. For subtotals:

  • Show: Eventswith script, language: Javascript, Run At: Clinet.

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 == "NETPR") {

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

}

}

this.rawValue = total;

2. For Grand total:

  • Show: Eventswith script, language: FormCalc, Run At: Clinet.

sum(data.Subform1.T_VBAP.Group1.DATA[].NETPR[])

Regards,

Raju.

Former Member
0 Kudos

Hello Raju,

I tried it, but its not working. It may be perhaps the way my Hierarchy is built.

I have 2 master pages

and 2 reference page

in each reference page i have my item table

Could you please tell me how to reference name of the field WRBTR in the table?

Perhaps it is this that is causing the issue as i am obtaining no result.

Many thanks

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Could you please help me implement this solution? I have the same request and I implemented your proposal, but it only works for me when there only one item per page. For pages with many items, the value of the subtotal field is always 0.

Please advice and let me know if you need more details.

Best regards,

Alexandra