Skip to main content
Participant
November 30, 2018
Answered

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

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";

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
November 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;

3 replies

Participant
November 30, 2018

That worked perfectly, thank you!!

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 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
Bernd Alheit
Community Expert
Community Expert
November 30, 2018

Where do you set the variable FinalScore?

Translate