Displaying a given text or a specific color, depending on whether a numeric value falls into a given numeric range

Hi there, I have a value stored in the database. Depending on the whether that value falls into a given range I want to display a text AND that text to be of a given colour.

Here are the values, the text and the respective colours:

Value Text Colour
90-99 Very Severe (red)
80-89 Severe (red)
65-79 High (orange)
25-64 Medium (yellow)
5-24 Low (green)
0-5 Very Low (green)

I know I could achieve this by making a load of conditionals… but this seems ugly and inefficient. Does anyone know of a clean way to achieve this? I am wondering if there might be a way to do this with option sets?


Six hardly seems like a “load” to me.

To me, it seems ideally suited to conditionals. Their whole purpose is to conditionally alter appearance based on data and/or states.

If you’re seeking a way to easily alter the ranges without having to edit every place they appear, then you can certainly use an option set to define the ranges.

1 Like

Yep, there sure is…

Just create an option set with the following attributes: low number (number), high number (number), colour (text - hexcode), text (text)

Then simply set the text you want to display to ‘get an option’ select all options, then filter it by the number in question, and display it’s text.

Do the same for the colour.


Thanks Adam,

This was exactly what I was looking for; works like a charm!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.