on 01-28-2010 5:22 PM
Hi All,
I have added a piece of javascript to my form to total a column within a table on my form, before I added grouping within the table it was working correctly but now it only seems to total the first group.
Here is the code
var fields = xfa.resolveNodes("data.Body_subset.List_subform.IM_LIST.DATA.GROUP.DATA[*].ZWERT");
var total = 0;
for (var i=0; i <= fields.length-1; i++) {
total = total + fields.item(i).rawValue;
}
this.rawValue = total;
I have tried debugging from the Adobe Reader but after following instructions to install the debugger it stopped my Reader working so I have had to give up and re-install. Is there any javascript guys who can point me in the right direction ?
Hello,
first: SAP recommend (and I recommend) not to script in the form if that is not necessary. And I think this time it is not necessary, right? Why don´t you sum your column in backend and only mark the sum rows with some flag and then handle marked rows (sums) the different way in the form (like use bold font or anything you want).
second: maybe the change you´ve made was change of the structure, right? Like add/ remove subform (add if you say "groupping"). That means that the path in the script is no longer relevant? Check that.
third: use app.alert(yourfield.rawValue) to debug your scripts (gives a message box, try that), only use this alert without the plus mark (I cannot write it, because it disturbs this pages internal coding).
Hope this helps, Otto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response but I guess I need to make it clearer , it is an offline scenario so there is no way of doing the calculation in the backend as the user is entering quantities offline. The second suggestion was a problem but I fixed the script to reference the node correctly as it started to error once I introduced grouping so that rules that one out. I will try the third suggestion as unless I can see the values at run time I have no chance to see that I am looping correctly.
Fixed the problem, the script should read
var oFields = xfa.resolveNodes("data.Body_subset.List_subform.IM_LIST.DATA[].GROUP.DATA[].ZWERT");
not
var oFields = xfa.resolveNodes("data.Body_subset.List_subform.IM_LIST.DATA.GROUP.DATA[*].ZWERT");
this gives me a total for all entries not just first group
Check here:
http://help.adobe.com/en_US/livecycle/es/FormCalc.pdf
especially chapter 13: Examples of Common Scripting Tasks
Otto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.