Padding in SSRS 2005

  • In my report I am using the following expression that displays the days of the week from a multi select parameter and concatenating it with a single select parameter that shows the time.

    =Join(Parameters!DelDay.Label, space(20) + Parameters!time.Label + vbcrlf)+ space(20) + Parameters!time.Label

    When I run the report, the time is not aligned properly. I need it to look like what's highlighted in blue.

  • This is just an idea, have you tried trimming the leading and trailing spaces using LTRIM or RTRIM ?


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • Not sure how that would work. Perhaps you can provide an example.

  • something like this..

    LTRIM(RTRIM(Parameters!time.Label)


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • Is this what you are referring to:

    =Join(Parameters!DelDay.Label, Space(20) + LTrim(RTrim(Parameters!time.Label + vbcrlf)))+ space(20) + LTrim(RTrim(Parameters!time.Label))

    This is the result I get:

  • What happens if you change the font to Courier New, or another non-proportional font?

    Dave

  • Well I think, I understood what is wrong with your code that is causing this format. After each day of the week, you are adding 20 space values and that is what is causing it. If you look at the output, the line for Wednesday is longer, where as for Monday, (since it is 3 characters shorter than Wednesday), the 9 AM in the output is aligned that much left to that of Wednesday's 9 AM.

    In order to get this straight, I can give a suggestion in logic that needs you to work on the code (I am a DBA, not a developer,so I am little bad on coding).

    Here is what I can suggest..

    Before you join the weekday, space and the time, get the length of the day, subtract it from a certain value (20), so that you add those spaces and the time value..

    So for Monday it would be 14 Spaces (Length of Monday is 6, deduct it from 20 = 14, so add 14 spaces)

    for Wednesday it would be 11 Spaces.

    All the Best..


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • I ended up just right justifying the cell and it aligned properly. The justification of the day of the week does not need to be left justified. Thanks to both for you input.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply