I am trying to change the color of a calculated number based on the value that is calculated. I have a series of questions that take in values and give a unique calculation value. I would like that new value to change color based on the numeric value. (Text turns red if number is below 3.0). I cant seem to get a new if statement to work in the "calculation column" of my survey.
Any help would be awesome!
I do this but use emojis. This how to post may help you get it.
You basically do the calc in a field then use that field in the label column.
You did not post a form or the if statement so pretty hard to trouble shoot it.
Hope that helps
Thanks Doug,
Here is my calculation code I know the numeric calculation works I just need the text color to change if the value is less than 3.0
(${building_substructure_weighted} * 5 * 0.01), if((${building_average_condition} < "3.0"),"✅")
Not sure what you posted that is not a valid statement. Unless this is two lines? Your if is unbalanced. Plus you are using a > on a string which is not going to work.
I think you are saying you want the number 3 to change color. You can but I would not because the the html will be in the value. Unless you have a second value to store.
I would use the emojis really. But you can do text also. Few diff ways to do it here.
Hope that helps
Yes you can. Just change the testint field in my sample with you calc.
Ok I included your code but I do not get the calculated value to show up. I removed your labels and tired to call the value
if((${building_substructure_weighted} * 5 * 0.01) < 3,'<font color="red">{building_average_condition}</font>',"${building_average_condition}")
building_average_condition is the name of the row I want to use
You put the field names in quotes for some reason that makes then strings. I think you want.
if((${building_substructure_weighted} * 5 * 0.01) < 3,'<font color="red">' + string({building_average_condition}) + '</font>',string(${building_average_condition}))
I would not use this as the value as the html will be in the data then but up to you.