Search code examples
reporting-servicesssrs-2008ssrs-2008-r2ssrs-2012

Removing blank spaces


My requirement is remove blank line from the address. I am doing it like this:

=Ucase(REPLACE(REPLACE(Fields!Address.Value, CHR(13), ""), CHR(10), ""))

Screenshot

It removes the blank line, however the line-breaks is inserted into the middle of the zip code:

Hamilton, ON L8R

1E2 CAN


Solution

  • You need to replace the correct character to remove the line.

    Try =UCASE(REPLACE(Fields!Address.Value, VBCRLF, ""))
    

    That will replace all line feeds, if you only want to replace line feeds where there is an empty line you will need to look for VBCRLF + VBCRLF

    =UCASE(REPLACE(Fields!Address.Value, VBCRLF + VBCRLF, VBCRLF))
    

    This answer provides an alternative method of achieving the same result.