Color of the values

So I am having a dumb thing and I guess I need a little bump. I am changing the color of a field according to the result. The value is a string which is a number from 0% to 100%. It is a string because I added % and it is like that in Firestore. Anyway, I change the color parameter with the script:

if (input <= ‘50’){
return ‘#FF0000’;
}
else if (input >= ‘51’ && input <= ‘84’) {
return ‘#0000FF’;
}
else if (input >= ‘85’){
return ‘#28B463’;
}
else if (input == ‘100’){
return ‘#28B463’;
}

It works just fine for every case except 100%. It refuses to be shown in green and it remains red. I have tried to change that line and put "input == “100%” but yet it keeps red. Any help?

Hi,
Try with
If (Input.includes(“100”)) {…}

1 Like

Thank you for your answer @Paolo_Lops. I couldn’t do it in the beginning but now I got it. Finally! I realized that being a string it is considering that 100% is a value after 10% and before 11% so I solved it.

Thank you!

1 Like

try with parseInt(…)

if (parseInt(input) == 100) …