How to highlight the background color for a field's value?

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I'm creating a formula text field to highlight the background of a field.  I'm getting the name of the field instead of the field's value.  I've tried many variations of the following formula.  When I don't get errors, I see the name of the field [Phase 1 Description] in my report instead of the value for the field. What is the proper syntax for displaying the field value with the highlighting?  Thank you so much.

Example

If([Category]="Phase 1","<div style=\"color:black; background-color:#0040ff;\">&nbsp;&nbsp;[Phase 1 Description] </div>","") 
Photo of Tamara

Tamara

  • 428 Points 250 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of Tamara

Tamara

  • 428 Points 250 badge 2x thumb
I figured this out, but thought I'd share should anyone else have this question in the future.  The issue was with my syntax.  Below worked for me.  The solution was to add "& in front of the field and &" after the field.  So I changed it to "&[My Value Field to Display]&" and now it works.

If([Category]="Phase 1","<div style=\"color:black; background-color:#0040ff;\">"&[Phase 1 Description]&" </div>","")
Photo of Hasan

Hasan

  • 20 Points
Hi May I know what is "Phase 1 Description" in your code? I understand that "Category" is your field name and "Phase 1" is the value of that field.
Photo of Tamara

Tamara

  • 428 Points 250 badge 2x thumb
It was one of the category options that a user could have selected.
Photo of Tamara

Tamara

  • 428 Points 250 badge 2x thumb
Just one of the value options for the category field.
Photo of Hasan

Hasan

  • 20 Points
Thanks for your reply. What kind of field it should be? Currently I have a drop down field with 2 values. If I select value1 it should highlight with yellow color and if I select value2 then it should highlight with RED color in VIEW mode. So could you please help me with this. Thanks.
Photo of Tamara

Tamara

  • 428 Points 250 badge 2x thumb

It is a formula text field with the "Allow some html tags to be inserted in the field" box check marked.