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

Getting text to show based on score conditions

Community Beginner ,
Aug 01, 2023 Aug 01, 2023

Hi all, is there a way I can get an image or text to display backed on the score in a text field? I have the text field that sums other scores in the assessment sheet. I would like a non-editable text to show based on this overall score i.e. score 0-49.99 shows 'fail', 50-60 shows 'Sat', 60-70 shows 'good' etc. 

 

Thanks 🙏

TOPICS
PDF , PDF forms
812
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 ,
Aug 01, 2023 Aug 01, 2023

Sure. You can use something like this as the custom calculation script of that field (let's say the other field is called "Score"):

 

 

var score = Number(this.getField("Score").valueAsString);
if (score<50) event.value = "Fail";
else if (score<=60) event.value = "Sat";
else if (score<=70) event.value = "Good";
// etc.

 

[edited: small mistake in the code fixed]

 

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 Beginner ,
Aug 01, 2023 Aug 01, 2023

Thanks Try67. When I put that in, it says there is a ) missing after argument list 1. I can see there is an opening ( but not sure where to put the closing one. 

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 Beginner ,
Aug 01, 2023 Aug 01, 2023

I fixed it, just put it where I thought it would fit to close the argument. Works perfectly, thank you so much 👍

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 ,
Aug 02, 2023 Aug 02, 2023

Thanks, I fixed it now. And glad to hear it's working well for 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
Community Beginner ,
Aug 02, 2023 Aug 02, 2023

No problems. Do you know by chance how to give minutes between 2 times? I've searched and tried to modify other scripts but cannot get it to work. Eg. 0800 (start) 0847 (end) gives 47 mins. I need it in 24hr and date does not matter.

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 ,
Aug 02, 2023 Aug 02, 2023

It would be better to start a new thread for a new question... Also, this subject was discussed here many times in the past. Did you try searching the forum first for past questions?

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 Beginner ,
Aug 02, 2023 Aug 02, 2023

Yeah I did search and tried a few suggestions but couldnt get it to work, I might be jsut too unfamiliar with what the code is to fault find. I'll see if I can get somone on Fiverr to do it for me. Thanks

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 ,
Aug 02, 2023 Aug 02, 2023
LATEST

If you're interested in someone writing this script for you, that's something I could do for you (for a small fee). You can contact me privately via a PM to discuss it further.

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