Hello Adobe Fam,
I am new to LiveCycle and was wondering if average calcuation works in LiveiCycle at all? I have a form that I built in Adobe Acrobat that works 100% and calculates dropdowns with no problem. Manager is now requesting to allow comment boxes to expand as more text is added which i can't figure out in Adobe Acrobat but able to do in LiveCycle with no issue, but the actual average calculation is not workinag at all for the 8 dropdowns now but works 100% in Adobe Acrobat?? One thing this code does is excludes N/A from being counted in calcuation if selected.
Below is script that came over from the working PDF I built:
// Average non-N/A values;
var aFieldNames = new Array("Dropdown1", "Dropdown2","Dropdown3","Dropdown4","Dropdown5","Dropdown6","Dropdown 7","Dropdown8");
// counter for non-N/A values;
var nCount = 0;
// variable to sum non-N/A values;
var nSum = 0;
// default value for result if no average computed;
event.value = 0;
// process array of field names;
for(i = 0; i < aFieldNames.length; i++) {
if(this.getField(aFieldNames[i]).valueAsString != "N/A") {
// field does not have a value of "N/A";
nCount++; // increment counter
nSum += Number(this.getField(aFieldNames[i]).value); // add value to sum
} // end value not N/A;
} // end loop processing one field;
// compute the average;
if(nCount != 0) {
// non-zero divisor so we can compute the average;
event.value = nSum / nCount;
}
Thanks N advance for any help