Skip to main content
Participant
November 19, 2021
Answered

Prepare Form - calculation result to generate assigned category via text

  • November 19, 2021
  • 1 reply
  • 718 views

Hi Everyone,

I'm working on a file with calculations. I have the calculation set to calculate the overall score from the 4 numbered boxes to the left. Depending on the overall score, I would like the Assigned Category section to autopopulate the corresponding category (i.e., if the score is 2.5, the assigned category should auto populate the text 'Key Performer'). I've attached a screenshot to help with my explanation. Does anyone know how to achieve this result? I have not been able to find any resources online specific to my situation. Thank you!

 

\\

 

This topic has been closed for replies.
Correct answer try67

As the custom calculation script of the text field you can enter something like this:

 

var score = Number(this.getField("Score").valueAsString);

if (score>=2.5 && score<5) event.value = "Key Performer";

else if (score>=5) event.value = "Star";

 

etc.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 19, 2021

As the custom calculation script of the text field you can enter something like this:

 

var score = Number(this.getField("Score").valueAsString);

if (score>=2.5 && score<5) event.value = "Key Performer";

else if (score>=5) event.value = "Star";

 

etc.

Participant
November 22, 2021

Thank you very much for your help try67! I was able to get this to work based on your feedback!

I did have one additional question I'm hoping you can help with - I want the Assigned Category to populate, but only once each of the fields have been selected. For instance, the Assigned Category section will populate only if each of the four drop down fields have been chosen by the user.

 

Looking forward to your feedback.

try67
Community Expert
Community Expert
November 22, 2021

Do these fields have a "neutral" default value, like "Select" or even just an empty string?