SSRS RTrim Function

The SSRS RTrim function is a Text function that removes the trailing spaces from the given field and returns a copy of the string. This article explains how to use the RTrim function to remove empty space from the right side of a string with an example.

The syntax of the SSRS RTrim function to create a new string by removing the trailing spaces is as shown below.

=RTrim(Fields!Name.Value)

To demonstrate the SSRS RTrim function, we use the Employee table below, which has 15 records. The image shows the records in the Table report. If you notice, there are empty spaces on the right and left side of the content in the Full Name and Email columns.

Source Table

SSRS RTrim function Example

For this, let me add a new column to the right side of the Full Name column. Next, right-click the textbox under the RTrim Name and choose the Expression. To understand the report, I suggest you refer to the articles on charts, tables, grouping, and format tables in SSRS.

It opens the following expression window to remove trailing spaces. The below SSRS RTrim function deletes the empty spaces from the right side of the Full Name column and returns a new string.

=RTrim(Fields!FullName.Value)
SSRS RTrim Function expression to remove right side empty spaces

Similarly, let me create one more column to the right of the email column. Next, right-click the textbox under RTrim Mail to write the expression below. Here, the RTrim function removes trailing spaces from the Email column. For more functions, Click Here!

=RTrim(Fields!Email.Value)

Please click the preview tab to see the result. Although the RTrim function removed the empty spaces on the right, you can see the spaces on the left side. To remove them, use the LTrim or Trim function.

SSRS RTrim Function to remove trailing empty spaces preview