Script to apply custom calculation to mulitple total textfields with input values (row/column )
Not sure if this is possible.
Have a form with text fields:
HoursRow1 RateRow1 TotalRow1
HoursRow2 RateRow2 TotalRow2
...with many more rows (hierarchical)
I want to write a script that will apply if else function for each TotalRow with the corresponding row number (use HoursRow1 and RatesRow1 for TotalRow1, etc)
It’s easy enough for one Total, add custom calculations:
var tot = this.getField("TotalRow1").value;
var hour = this.getField("HoursRow1").value;
var cost = this.getField("RateRow1").value;
if (hour && cost) {
event.value = hour * cost;
}
else
{
event.value = "";
}
But there are a lot of rows, so it would be a lot easier (if I knew how) to put this in a script to not have to enter each TotalRow manually. Put some type of wildcard in place , plus dealing with more than one variable, but move through so the right variables are put in for corresponding total
(TotalRow1 with HoursRow1 and RateRow1, TotalRow2 with HoursRow3 and RateRow3, etc)
Do not see how to do this with needing the check all three (Total, Hours, and Rate)
