Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with showing an average results as a letter

New Here ,
Mar 02, 2023 Mar 02, 2023

I have no experience with Java script, but we want to be able the average results of our to show as a letter.

For example, Rating: Above Target can equal 3, On Target = 2, Below Target =1.

We want the average of those ratings to show at the bottom of the form as a letter.

So if the average is between 2 and 2.5, then it should be OT(on target), if <2.6 then Above Target, etc. 

I see there's an option for custom calculation, but not sure what to add. Thanks in advance

 

TOPICS
How to , JavaScript , PDF forms
574
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2023 Mar 03, 2023
LATEST

You'll need to use a script in the custom calculation for the average.

This script assumes the calculation is done in the same field that shows the letters. 

Also, the calculation is not shown, because that part is up to you. 

(On another note, your rule that  "Above Target" is when the ave<2.6 doesn't fit with the first condition.)

var nAverage = ... some calculation ...;

if((nAverage >=2) && (nAverage <= 2.5))
   event.value = "OT";
else if((nAverage >2.5) && (nAverage <= 3.0))
   event.value = "somethign else";
else
  event.value = "N/A";

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines