Hello, I am looking to reduce the number of decimal places after averaging.
The average that I calculated 3+1+1 is 1.666666666666667
and it is displaying that answer, but what I would like is that after adobe calculates the average, it will only give me two decimal places. 1.67
This is the code that I am using:
var nSum = 0; nCnt = 0;
var nVal = this.getField("Proskills" + i).value;
if(!/^\s*$/.test(nVal) && !isNaN(nVal))
nSum += nVal;
event.value = (nCnt > 0)?nSum/nCnt:"N/A";
After I input
then event.value =(util.printf("%0.2f",nVal));
I am no longer able to change the average
Can you please help me calculate an overall average and them reduce my results to two decimal places
Change the last line to:
event.value = (nCnt > 0)?(nSum/nCnt).toFixed(2):"N/A";
Much respects to you!