Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Having troubles adding hidden fields, using a variable from data connection?

Avatar

Level 1

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?

0 Replies