April 5, 2016 at 9:08 am
Hi
Is it possible to change the font color if text contains the word "Cancelled"?
Just an FYI, if it matters the word can be anywhere in the text
Thanks in Advance
Joe
April 5, 2016 at 12:10 pm
Joe,
Do you only want to format the word "cancelled"?
This highlights the whole field:
=IIF(InStr(LCase(Fields!AcctStatus.Value),"cancelled")>0,"Red","Black")
(but it depends on what you attach the formatting to).
April 5, 2016 at 12:51 pm
Thanks for getting back.
I would like to highlight only the word "Cancelled" in the text.
But this will work if I can't do that
Thanks Again
April 5, 2016 at 12:58 pm
Is the text containing the word "cancelled" static (or there are a limited number of versions of it)?
Might be that I don't know enough about SSRS, but I think you have to know which word you're formatting beforehand, so you know where to apply the formatting.
How is the string containing the word "cancelled" being created?
April 5, 2016 at 1:03 pm
no, just using a LIKE '%canceled%' on a note field to find repords that have the word "cancelled" in that field
so it can be anywhere in that field
April 5, 2016 at 1:49 pm
Now I'm confused. LIKE is a SQL keyword. AFAIK, you can't use it in SSRS.
If you're trying to color the word "cancelled" red, then you could do something like use REPLACE and replace the string "cancelled" with something like "<span style='color:red;'>cancelled</span>" and then tell SSRS to treat the text like HTML.
April 5, 2016 at 2:18 pm
Thanks and sorry, I used the Like in the stored proc that I was pulling the data
but the replace was what I was looking for
Thanks Again
April 5, 2016 at 6:24 pm
Super convenient that it's called REPLACE in T-SQL and something entirely different in .NET/SSRS, right?
I ended up with this:
=Replace(UCase(Fields!AcctStatus.Value),"CANCELLED","<span style='color:red;'>Cancelled</span>")
Maybe I'm doing it wrong, but it would be super handy to be able to do a case insensitive search/replace in .NET...
so I made the string uppercase for comparison purposes and then did the Replace...
Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply