on 06-03-2009 2:35 PM
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®ards;
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.