Trying to set the background color on a field with a condition. Keep getting errors.

  • 0
  • 1
  • Question
  • Updated 10 months ago
  • Answered
Trying to set the background color on a field with the following condition. Its not working. 

If(Contains([Cut Status], "Fabrication Ready"), "<div style=\"background-color:#0CF52B;\">("[Digital Front]"&"-Rev"&"[Revision]")</div>", [Cut Status])

Is this possible to do?
Photo of Gary Doucet

Gary Doucet

  • 270 Points 250 badge 2x thumb

Posted 10 months ago

  • 0
  • 1
Photo of Ursula Ll

Ursula Ll

  • 1,446 Points 1k badge 2x thumb
I'm assuming the "& -Rev &" is part of the text to go inbetween digital front field and revision field.
Using the \ to escape out the quotes works, but it makes it harder to read, so I have replaced that with single quotes. The & needs to be in front and behind the QB field you are using. Hope this works!

If(Contains([Cut Status], "Fabrication Ready"), 
"<div style='background-color:#0CF52B;'>(" & [Digital Front] & "-Rev" & [Revision] & ")</div>",
[Cut Status])
(Edited)
Photo of Gary Doucet

Gary Doucet

  • 270 Points 250 badge 2x thumb
Thanks Ana.

This is effecting the Contains Statement now. Like I think this should work.  

Photo of Ursula Ll

Ursula Ll

  • 1,446 Points 1k badge 2x thumb
If(Contains([Cut Status], "Fabrication Ready", 
"<div style='background-color:#0CF52B;'>(" & [Digital Front] & "-Rev" & [Revision] & ")</div>", 
[Cut Status]))

See if that works
(Edited)
Photo of Gary Doucet

Gary Doucet

  • 270 Points 250 badge 2x thumb
Thanks, I will try something different. 
Photo of Gary Doucet

Gary Doucet

  • 270 Points 250 badge 2x thumb
Ok this Works.  I changed the List box just to a Text field and did this Formal and it Worked.


So this issue has to be with the Contains Function.