Skip to main content
Participant
August 22, 2024
Answered

How to populate a text field based on a range of numbers in another text field

  • August 22, 2024
  • 1 reply
  • 782 views

I have a text field "Overall Performance" that needs to auto populate one of 3 possible words, based on a score number in another text field "Total Score". The "Total Score" field on page 1 is already set to display the number from the same field on page 12 by having both boxes named the same. The "Total Score" field on page 12 is set to calculate a sum and multiply it by 0.01. On page 1, the "Overall Performance" box should display one of the following words based on the "Total Score" number range:

 

Total Score = 2.50 to 3.00, Overall Performance = Exceptional

Total Score = 1.50 to 2.49, Overall Performance = Successful

Total Score = 0.00 to 1.49, Overall Performance = Unsuccessful

 

I need these words to auto-populate into that field and not be a user-selected field, like a drop down. I've been searching for how to do this and have seen other solutions using some coding in the validation script box, but I unfortunately just don't know or understand enough about the coding to figure out how to get it to work for this particular need. Hoping someone can help me out with this!

 

 

This topic has been closed for replies.
Correct answer PDF Automation Station

Enter the following custom calculation script in the Overall Performance field:

var total=this.getField("Total Score").value;
if(total <= 1.49)
{event.value="Unsuccessful"}
else
if(total > 1.49 && total <= 2.49)
{event.value="Successful"}
else
{event.value="Exceptional"}

1 reply

PDF Automation Station
Community Expert
Community Expert
August 22, 2024

Enter the following custom calculation script in the Overall Performance field:

var total=this.getField("Total Score").value;
if(total <= 1.49)
{event.value="Unsuccessful"}
else
if(total > 1.49 && total <= 2.49)
{event.value="Successful"}
else
{event.value="Exceptional"}
Participant
August 22, 2024

Thank you SO much! I tested it in all three ranges and it worked perfectly!