SSRS – Capitalize the first letter

SSRS – Capitalize the first letter

Need the ability to Capitalize the first letter of a string within SSRS? I found a gem of an SSRS function by Paul Turley of SolidQ.

From SSRS Report Properties switch to the Code tab and enter the following custom function:

Function ProperCase(InputString as String) As String
Dim i as Integer
If InputString  <> “” Then
Mid(InputString , 1, 1) = UCase(Mid(InputString , 1, 1))
For i = 1 To Len(InputString) – 1
If Mid(InputString, i, 2) = Chr(13) + Chr(10) Then
Mid(InputString, i + 2, 1) = UCase(Mid(InputString, i + 2, 1))
End If
If Mid(InputString, i, 1) = ” ” Then
Mid(InputString, i + 1, 1) = UCase(Mid(InputString, i + 1, 1))
End If
Next
Return InputString
End If
End Function

Now within your Reporting Services field expression, add:

=Code.ProperCase(LCase(Fields!field_name.Value))

Works a treat in SSRS 2008. Good luck!

Mike250

Australian. Sport. Passionate Cricket Fan. Go Pro. Abseiling. Snorkeling. Travel. Golf R. SQL Server Developer. Three sons. One daughter. Last Trip: New York.

Related Posts
1 Comment
    • Wiesman32892
    • On: March 2, 2014

    Regards for helping out, good information.

    Reply
Leave a comment

Your email address will not be published. Required fields are marked *