Creating Repeating Subform For Loop

Avatar

Avatar

Baller_Shot_Cal

Avatar

Baller_Shot_Cal

Baller_Shot_Cal

26-01-2017

Need some help creating a for loop in FormCalc.

If text entered in “myField” and “Inv” fields are the same, sum amounts ”amt” in a repeating
subform.  This concept seems to work ok, in javascript using static subforms,

e.g, subform0, subform1, subform3, etc... However, can’t get it to work with repeating subforms.


Thanks,  

FormCalc version

var amt = Ref(subform1[*].myAmounts.nodes)

var inv = Ref(subform1[*].myInventory.nodes)

var i

for i=0 upto (i <= amt.length-1) do

if (myField == inv.item(i)) then

$ = Sum(amt)

      endif

endfor

____________________________________________________________

JavaScript version -  Works with static subforms, but not with repeating subforms.

var amt = xfa.resolveNodes("subform1[*].myAmounts");

var inv = xfa.resolveNodes("subform1[*].myInventory");

var sum = 0;

for (var i=0; i <= amt.length; i++) {

if (myField.rawValue == inv.item(i).rawValue) {

sum = sum + amt.item(i).rawValue;

     }

     this.rawValue = sum;

}

Accepted Solutions (0)

Answers (0)