Avatar

Correct answer by
Level 10

Hi,

as the GoalSheet is a repeatable instance as the Others row you have to loop through all its instanced too.

var goalSheets = _GoalSheet.count,

          sum = 0;

for (var i = 0; i < goalSheets; i += 1) {

          var vGoalSheet = form1.resolveNode("GoalSheet[" + i + "]"),

                    vOthers = vGoalSheet.Table6._Others.count;

          if (vGoalSheet.Table6.First.Funding1.rawValue == "1") {

                    sum += vGoalSheet.Table6.First.Funding1.rawValue;

                    for (var j = 0; j < vOthers; j += 1) {

                              sum += vGoalSheet.Table6.resolveNode("Others[" + j + "]").Cost2.rawValue;

                    }

          }

}

this.rawValue = sum;

Hope this helps.

View solution in original post