Hi all,
I am trying to program a snippet to do the following: I would like to enter a numeric score into a text field and have it generate a qualitative descriptor for that score. For example, a score 100 is within the range of 85 to 109, therefore it is "average". I am struggling to understand how I can assign numerical ranges to a text descriptor that can be looked up based on the data I enter.
Any help would be appreciated. Thank you!
Hey @Alessandro_Bellantuo , welcome to the community!
There's a few ways that you could do this. I'd recommend using an {if}
command to evaluate the text field and then output what you want it to say. I need to make sure that the text field first has a name assigned to it so I can refer back to it in my {if}
command. Here's an example below:
Input number: {formtext: default=100; name=score}
{if: score<85}The score is less than 85{elseif: score<100}The score is 85 or above, but less than 100{elseif: score<125}The score is 100 or above, but less than 125{elseif: score>=125}The score is 125 or greater.{endif}
This uses the {elseif}
component of the {if}
command. I'm using it to define all the different potential outcomes.
Let me know if this is unclear, you have additional questions, or if you'd like to set up time to review this on a video call.
1 Like