The SSRS CChar function is a Conversion function that will convert the given field or expression to a character. If a single character is in a column, it’s better to convert a character instead of a string. The syntax of the CChar function for converting string to character type is as shown below.
=CChar(Fields!MaritalStatus.Value)
=CChar("TutorialGateway")
To demonstrate the CChar function in reporting services, we use the Employee table below, which has 20 records. The image shows the records in the Table report.
SSRS CChar function Example
For this, let me add a new column to the right side of the Gender column. Next, right-click the textbox under the CChar Gen and choose Expression to open the below expression window. The CChar expression below will convert the String Gender column to the character type.
=CChar(Fields!Gender.Value)
Similarly, let me create two more new columns to convert the string first name and last name columns to character datatype. Using the SSRS CChar function on the string, we will consider the first character from the complete string and convert it to the character.
=CChar(Fields!FirstName.Value)
=CChar(Fields!LastName.Value)
Please click the preview tab to see the CChar report.