I want to calculate the total for a field of repeating item, from the Level Scripting Support, the resolveNodes is supported in mobile HTML form. But after getting the repeating object using resolveNodes, how can we get the length of the object for calculating.
I used the objs.length but it is undefined. Here are the my script as example:
var objs = expenses.expensesWrapper.resolveNodes("expenseRow[*]");
xfa.host.messageBox(objs,"",0,0);
xfa.host.messageBox(objs.length,"",0,0);
var sum = 0.0;
for (var i = 0; i < objs.length; i++){
sum += objs.item(i).total.rawValue;
}
expenses.total.subTotal.rawValue = sum;
Views
Replies
Total Likes
OK, I found a resolve for this total calculation functionality in both PDF and HTML forms, I used the following scripts:
var len = expenses.expensesWrapper._expenseRow.count;
var sum = 0.0;
for (var i = 0; i < len; i++){
sum += xfa.resolveNode("expenses.expensesWrapper.expenseRow[" + i + "].total").rawValue;
}
expenses.total.subTotal.rawValue = sum;
Views
Replies
Total Likes