on 05-04-2009 1:40 PM
HI,
I am displaying sales order item data using adobe forms,
For the field NETWR i have to calculate subtotals and display on each page and grand total and display at the end of all pages
for that i searched this form and found the below code
For Each page sub totals in Adobe forms please find the below code
Select "Events with Scripts" in the Show drop down list
Select "JavaScript" in the Language drop down list
Run at: "Client" as shown below.
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;
Below code to handle the Grand totals in Adobe forms
sum(Data.Table1.Group1.Row1[*].PRICE[*])
In the above code i have replaced 'PRICE' to 'NETWR'
Is that ok or please let me know if anything else needed to be changed in the above code to suit my requirement
Do i have to write my table name in place of 'Table1' and anywhere else?
My main doubt is do i have to place 2 numeric fields at the end of the page to hold these totals, then how to link the codes to those fields?
if i select the numeric field and try to Select "JavaScript" in the Language drop down list, it is not allowing me, please let me know how to link the code
Please help me out in this issue.
Regards,
Sowjanya
Hi,
Yes you have to replace "Table 1" with your table name.
You can take numeric fields. For grand totals and subtotals
for Subtotals:
Which field you want to calculate the subtotal, take the name of that field and then
Select the subtotals numeric and then
a) Select "Calculate" event in the Show drop down list
b) Select "FormCalc" in the Language drop down list
c) Run at: "Client"
Just write Sum(Amount[*]).
where Amount is the name of the field which you want to calculate the total
or else you are interest in Scripting you can write above code also.
For grand totals
You can use numeric text field/ and follow the same steps a, b and c like in the subtotals and write the code in JavaScript/ Form Calc which ever you are interested.
Thanks
Srikanth(sriiiii)
Edited by: sriiiiiiii on May 4, 2009 6:45 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For grand totals and subtotals
For grand totals
Which field you want to calculate the grand total, take the name of that field and then
Select the Grand totals numeric and then
Go to the Object palette -> Under Value tab -> Select the type as Calculated - Read Only -> Under this Select radio button Calculation script
a) Select "Calculate" event in the Show drop down list
b) Select "FormCalc" in the Language drop down list
c) Run at: "Client"
Just write Sum(NETWR[*]).
where Amount is the name of the field which you want to calculate the grand total
Try this code, I think It will work
Thanks
Srikanth(sriiiii)
Hi Sri,
For calculating grand total, isn't it the sum of the subtotals that we should calculate? For example, to calculate sub total for the field "amount" we write it as Sum(amount[]). Then for grand totals, isn't it the sum of sub totals like Sum(sub totals[]) or something ? We make these total fields(sub total and the grand total) calculated-Read only and calculation script, then what is the difference between the code for sub total and grand total ?
I am new to adobe forms and started learning it. So please clarify my question or correct me if I am wrong.
Your help would be appreciated.
Thanks and Regards,
RVSS.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.