Skip to Content
author's profile photo Former Member
Former Member

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

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;

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 04, 2009 at 06:58 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Feb 16, 2016 at 02:27 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.