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

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

New Here ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

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

Views

124

Likes

Translate

Translate

Report

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;

Likes

Translate

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

Copy link to clipboard

Copied

Where do you set the variable FinalScore?

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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;

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

That worked perfectly, thank you!!

Likes

Translate

Translate

Report

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