Need help to sum and then average 6 text boxes
my hr department dropped 1 on lap 3 afternoon , need asap develop training. i'm stuck , reaching out it.
we have pdf form employee evaluation. in piece in question, there 6 sections , employee rate on scale of 1 5 how met objectives in question. problem not fill out 6 sections don't apply everyone. people may fill out 6 may 4 or 3. need figure out how average out scores get. summing easy part - can't figure out how tell how many ratings have been filled in i'll know how may fields have divide total in order average rating bunch. it's image below, offer appreciated.
you'll have use custom calculation script, like:
// custom calculation script text field
(function () {
// set variables
var ncount = 0; // number of non-bank fields
var nsum = 0; // sum of non-bank fields
var afieldnames = ["grow", "build", "finance", "impact", "culture", "other"];
var i, f;
// loop through fields named in array
(i = 0; < afieldnames.length; += 1) {
// reference current field
f = getfield(afieldnames[i]);
// if field not empty...
if (f.valueasstring) {
ncount += 1; // increment count of non-bank fields
nsum += +f.value; // add field value running total
}
}
// calculate average
if (ncount > 0) {
event.value = nsum / ncount;
} else {
event.value = ""; // blank field if fields blank
}
})();
More discussions in JavaScript
adobe
Comments
Post a Comment