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

I'm an Australian Chief Analytics Officer passionate about data science, visual insights, and all things sport—particularly cricket. An adventurer at heart, I’ve gone from abseiling cliffs to snorkeling in crystal-clear waters, sleeping in the wilds of Africa, and exploring destinations worldwide, with my latest trip taking me to Bali. When I'm not diving into data or analytics, I'm spending time with my three sons and two daughters, attempting to hit sixes for my local cricket club, reviewing chicken schnitzels or honing my craft around a coffee machine.

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 *