Sorry for the delay in getting back to you ..... I was looking for a sample that I could provide.
The technique to use would be to get a list of all objects that are on the page that you want to create the subtotal on. Then with this reduced set of objects, search out the individual fields and add then together to make your total. In the example I have we created a function to do this and passed the object subtotal object itself to the function. The function then determines which page the object is on, gets all field objects from that page (in our case we are asking to add all fields called fldSavings), then cycles through each field and totals them and finally returns the sum back to the calling program. Hope this helps .... see the code below we call it in this way:
scoScript.getPageTotals(this.name);
Here is the function:
function getPageTotals(objFld){
var nPage = xfa.layout.absPage(objFld);
var oFields = xfa.layout.pageContent(nPage , "field");
var nFieldCount = oFields.length;
var numFldTotals = 0;
for (var nNodeCount = 0; nNodeCount < nFieldCount; nNodeCount++)
{
if (oFields.item(nNodeCount).name == "fldSavings")
{
numFldTotals = numFldTotals + oFields.item(nNodeCount).rawValue;
}
}
return numFldTotals;
}