Select to view content in your preferred language

Color formatted calculation causing survey send errors

122
3
11-28-2024 05:42 PM
j-bromp
Regular Contributor

A while back i added some color formatting to a calculation and it worked fine then one day it stopped working. I abandoned the idea for a while but am now revisiting it. I am using this calculation:

concat('<font color="', if(${pf_single} = 'F', 'red', 'black'), '">', if(${pf_single} = 'P', 'P', if(${pf_single} = 'F', 'F', '-')), '</font>')

to color Fails in red and the rest in black. it lets me save and even publish and works in the survey on connect however when i try and send a real survey i get a database error. the idea is to have the coloured F pull through to a report. Any one had this issue before with coloring a calculated field?

0 Kudos
3 Replies
abureaux
MVP Frequent Contributor

You have a lot going on there. For starters, I'd not nest IF() statements inside a concat(). Make them their own calculate fields and reference those.

DougBrowning
MVP Esteemed Contributor

If you do this you will forever have html in your data and it will drive you nuts.  Do not recommend.  

I would try adding a second value that is just the color and hide it in the form then use in the report.  Not sure if reports can do color?

j-bromp
Regular Contributor

ok thanks, i abandoned the colour again. will come back to it

0 Kudos