Sum across rows named "Hour.row#.col#"
I have a 28x14 grid of form fields that are named "Hour.1.1" where the first digit is the row number and the second is the column number. I have managed to figure out how to sum across the columns using a document level function and a custom calculation script, but I can't figure out how to tweak it to sum across rows. The code that works to sum across columns is below. Please help!!!
// document level function
function SumH(cParent){
var nSum = 0;
var oParent = this.getField(cParent);
var aParent = oParent.getArray();
for(var i = 0; i < aParent.length; i++){
nSum += Number(aParent.value);
}
return nSum;
} // end SumH function
// end document level script
// Custom Calculate script
// use document level function
var sum = SumH("Hour.1");
// field value is blank unless sum greater than zero
if (sum === 0) {
event.value = "";
} else {
event.value = sum;
}
