SSRS StrDup Function

The SSRS StrDup function is a Text function that repeats the given character a specified number of times and returns a string or object. Although you provide a complete string, it considers the first character and repeats that one.

The syntax of the SSRS StrDup function accepts two arguments, as shown below. The first argument is an integer that specifies the number of times the character has to repeat. The second one is either a string or a character.

=StrDup(7, "T")

To demonstrate the StrDup function, we use the Employee table below, which has 15 records. The image shows the records in the Table report.

Source Table

SSRS StrDup function Example

For this, let me add a new column to the right side of the FirstName column. Next, right-click the textbox under the StrDup 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.

Choose the expression option

It opens the following expression window to duplicate characters. The below SSRS StrDup function will duplicate (repeat) the first character in the First Name field five times.

=StrDup(5, Fields!FirstName.Value)
SSRS StrDup Function expression to duplicate string characters

Similarly, let me create one more new column to the right of the LastName. Here, we use the 4 as the first argument of the StrDup function, so the first character from the Last Name field repeats for four times.

=StrDup(4, Fields!LastName.Value)

Please click the preview tab to see the report. For more functions >> Click Here!

SSRS StrDup Function to duplicate string character report preview