Format only specific text ???

  • 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

  • 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).

  • 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

  • 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?

  • 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

  • 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.

  • 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

  • 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