on 09-20-2011 1:38 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Rakesh,
if i remove the the "var total = 0 ;" then my field on the PDF is empty,
If i only declare it in initialized, then i also get nothing.
Do you have any other idea?
If it is helpfully for you to help me, then i can send you the form, the interface and a example xsd file.
Regards
Florian
I try following:
var fields = xfa.layout.pageContent(xfa.layout.page(this), "field", 0);
for (var i=0; i <= fields.length-1; i++) {
if (fields.item(i).name == "ZZPR00_GES") {
total.value = total.value + fields.item(i).rawValue;
}
}
this.rawValue = total.value;
or
var fields = xfa.layout.pageContent(xfa.layout.page(this), "field", 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.value;
or
var fields = xfa.layout.pageContent(xfa.layout.page(this), "field", 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;
I dont understand why it is everytime empty.
Do you have another script for calculating the subtotal?
Thanks for your help
Florian
Hello Florian,
try this script.
var page = xfa.layout.page(this);
var fields;
for(var j = 1; j <= page; j++)
{
fields = xfa.layout.pageContent(xfa.layout.page(this)-j, "field", 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,
Rakesh.
Hello,
now i know the problem.
If you start the Designer 9 directly in Windows and import the form and click on preview you see 10 Sites with 2 positions on every site.
the subtotal is correct.
If you open the Designer with the Transaktion SFP and click on preview you get 5 Sites with more position on every site.
The subtotal is wrong.
If you print it from SAP and have a look in the spool, you also see 5 sites with more then 2 position on every site.
I think this is the reason why you Rakesh have no problems with the subtotal.
I am in contact with SAP and i told them this issue.
If i have a sollution i will post it in this thread.
Regards
Hello,
now the problem ist solved.
The correct coding is
var fields;
var total = 0;
var page = xfa.layout.page(this);
for(var j = 0 ; j < page; j++)
{
fields = xfa.layout.pageContent(j, "field", 0);
for (var i=0; i < fields.length; i++)
{
if (fields.item(i).name == "ZZPR00_GES")
{
total = total + fields.item(i).rawValue;
}
}
}
this.rawValue = total;
Additionaly all scripts must have "Client and Server".
In fom properties Tab "default" Option Server you must select "dynamic XML form".
If not, you got some problems with the numbers of pages.
Regards
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.