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

How to return a string based on a value in the box next to it?

New Here ,
Nov 30, 2018 Nov 30, 2018

Hello, 

I am making a dynamic form and I want the field "ScoringKey" to return a string based on a score that is calculated in the field next to it, "FinalScore". Is this possible? I cant seem to get the field "ScoringKey" to return a string no matter the parameters.

Basically

  • if final score is greater than 1.00 but less than 1.99 return “Unsatisfactory”
  • If final score is greater than 2.00 but less than 2.99 return “Needs Improvement”
  • If final score is greater than 3.00 but less than 3.99 return “Meets Expectations”
  • If final score is greater than 4.00 but less than 4.99 return “Exceeds Expectations”
  • If final score is equal to 5.00 than return “Outstanding”

This is what I have for code:

if (FinalScore < 2 && FinalScore > 0.99) text = "Unsatisfactory";

if (FinalScore < 3 && FinalScore > 1.99) text = "Needs Improvement";

if (FinalScore < 4 && FinalScore > 2.99) text = "Meets Expectations";

if (FinalScore < 5 && FinalScore > 3.99) text = "Exceeds Expectations";

if (FinalScore === 5) text = "Outstanding";

TOPICS
Acrobat SDK and JavaScript , Windows
447
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

correct answers 1 Correct answer

Community Expert , Nov 30, 2018 Nov 30, 2018

Add this line to the start of your code:

var FinalScore = Number(this.getField("FinalScore").valueAsString);

And this line to the end of it:

event.value = text;

Translate
Community Expert ,
Nov 30, 2018 Nov 30, 2018

Where do you set the variable FinalScore?

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 ,
Nov 30, 2018 Nov 30, 2018

Add this line to the start of your code:

var FinalScore = Number(this.getField("FinalScore").valueAsString);

And this line to the end of it:

event.value = text;

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
New Here ,
Nov 30, 2018 Nov 30, 2018
LATEST

That worked perfectly, thank you!!

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