reporting-servicesssrs-expression

How do I add a character at the end of a field to get the total to 100 characters?


I'm writing an SSRS report for an Association directory. They would like each line to look like this: Title...........Name

The characters from the Value of Title and the dots should equal 100 characters.

This is what I have tried so far:

=Left(Fields!TITLE.Value & ".", 100) & Fields!Name.Value

=Fields!TITLE.Value & StrDup(100 - Len(Fields!TITLE.Value), ".") & Fields!Name.Value

Neither of those worked. Does anyone know how to do this?


Solution

  • This is untested as I can't try it right now but the following should work.

    =Fields!TITLE.Value & StrDup(100 - (Len(Fields!TITLE.Value) + Len(Fields!Name.Value)), ".") & Fields!Name.Value
    

    If this does not work, please edit your question and supply some sample data. You may have to wrap all the field references in a TRIM() is there are any leading/trailing spaces in the title or name fields. e.g. all instances of Fields!TITLE.Value would become TRIM(Fields!TITLE.Value)