Assuming my Data Connection is setup properly how could I use that data to add up a sum of records?
This is what I Have but have had no luck:
var cRecordii = xfa.record.nodes.item(nIndex);
var oLoan = xfa.resolveNode("oLoan");
var hForm = xfa.resolveNode("hTitle");
var cCurrentBalance = null;
oLoan.resolveNode("aggCalc").rawValue = 0;
oLoan.resolveNode("aggCalc2").rawValue = 0;
for (var nColIndex = 0; nColIndex < cRecordii.nodes.length; nColIndex++){
switch(cRecordii.nodes.item(nColIndex).name) {
case "CurrentBalance": cCurrentBalance = cRecordii.nodes.item(nColIndex); break;
default: break;
}
xfa.host.messageBox("Testing" + " | " + oLoan.resolveNode("aggCalc").rawValue + " | " + oLoan.resolveNode("aggCalc2").rawValue + " | " + oLoan.resolveNode("aggTotal").rawValue);
oLoan.resolveNode("aggCalc2").rawValue = oLoan.resolveNode("aggCalc").rawValue;
oLoan.resolveNode("aggCalc").rawValue = cCurrentBalance.value;
oLoan.resolveNode("aggTotal").rawValue = oLoan.resolveNode("aggCalc2").rawValue + oLoan.resolveNode("aggCalc").rawValue;
}
oLoan.resolveNode("tAggregate").rawValue = oLoan.resolveNode("aggTotal").rawValue;
Orginally I tried to have cCurrentBalance = cCurrentBalance + cRecordii.nodes.item(nColIndex); but I was told this cannot work like this. I would have to use hidden fields so I tried to assign the cCurrentBalance.value to a hidden numeric field and then add those together to get a "running total" but it is still getting an error. what am I missing?