I am trying to modify the font color of a specific word in my values. What kind of expression could I write that would target this word and style the font to be red? I've heard of modifying the placeholder to accept HTML but I'm not sure this will help.
The value is made up from a case in the dataset that pulls from two tables that have gender so: "(consumer gender) | (caretaker gender)"
Possible values would be: Male | Male, Male | Female, Missing | Male, Missing | Female, Missing | Missing ….etc
What I'm trying to do is just target the "Missing" values and change the font color to red. Any way to do this? I've tried modifying the font color expression but only can figure out ways to modify the whole string as opposed to just that one word.
You can do this but it's a bit of a pain..
I used a quick dataset to demo the results built from the following SQL
DECLARE @t TABLE (textData varchar(20))
INSERT INTO @t VALUES
('Male | Male'), ('Male | Female'), ('Missing | Male'), ('Missing | Female'), ('Missing | Missing')
SELECT * FROM @t
The column we will use is just called textData
Start with an empty cell. In the empty cell, double click to get a cursor, right-click inside the cell and choose "Create Placeholder" Right-click the placeholder and set it's expression to somethign like...
=TRIM(LEFT(Fields!textData.Value, InStr(Fields!textData.Value, "|") -1))
This will get the text from the left side from the pipe symbol. Click OK to get back to designer. click just after the new placeholder and type the pipe symbol (with spaces if required).
Next right click after the pipe symbol and add another placeholder. This time we will use an expression to get the right side of the pipe symbol.
=TRIM(MID(Fields!textData.Value, InStr(Fields!textData.Value, "|")+1 ))
Now we've got the data displaying, select the first placeholder and set its color
property to
=IIF(TRIM(LEFT(Fields!textData.Value, InStr(Fields!textData.Value, "|") -1)) = "Missing", "Red", Nothing)
repeat for the second placeholder this time using this expression.
=IIF(TRIM(MID(Fields!textData.Value, InStr(Fields!textData.Value, "|")+1 )) = "Missing", "Red", Nothing)
IN my simple design, the left column shows the original unaltered data from the dataset, the right column contains out two placeholders with colors. The final output looks like this.