I have developed a dynamic form in which the user can add categories and items to a bid proposal form. I have been successful at getting the item amounts to calculate and the subtotals to calculate but unsuccessful with any script that will result in the sum of all the subtotals. I am not a programmer and I am just learning formcalc and javascript. I would be very grateful if the experts on this forum could help me. Below is some of the scripts that I have tried and a screen capture of the form hierarchy:
Example 1:
// Access a field in a repeating subform by looping through the node list.
var oFields = xfa.resolveNodes("ItemCategories[*].SubTotal");
var nNodesLength = oFields.length;
var nSum = 0;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
nSum += oFields.item(nNodeCount).rawValue;
}
TotalBid.rawValue = nSum;
Example 2:
var c = this.getField("Category");
var a = c.getArray();
var sum = 0;
for (i =0; i <a.length; i++)
var f = this.getField("SubTotal");
var b = f.getArray();
var sum = 0;
for (i =0; i < b.length; i++)
sum += b[i].value;
if (sum !=0)
event.value = sum;
else
event.value = "";
Views
Replies
Total Likes
FormCalc uses less coding than Java Script on the calculations. also the processing time also will be less.
If you can send the form to LiveCycle9@gmail.com then I can send you back the form with the script in it.
Thanks
Srini
Views
Replies
Total Likes
I will be out of the office starting 07/20/2010 and will not return until
07/26/2010.
I will respond to your message when I return.
Views
Replies
Total Likes
Thank you Srini!
The solution was simpler than I ever thought.
This forum is awesome!
Below is the magic script that works in my form:
Sum(form1.BidForm.Table1.Categories[*].ItemCategories.Table2.FooterRow.SubTotal);
Views
Replies
Total Likes