http://www.sqlservercentral.com/blogs/dknight/2011/09/22/ssrs-_1320_-dealing-with-truncating-spaces/

Printed 2014/08/30 09:04PM

SSRS – Dealing with truncating spaces

2011/09/22

I apologize ahead of time on this post today because it will require lots of pre explanation and screenshots to set the stage for what I want to show you! Often when building a report with multiple row groupings I like to change the default way SSRS places the fields on the report. Default multiple row groups:

image

While this behavior is fine it can lead to a lot of useless white space when browsing the report.

image.

So what I like to do is still have the three groups by eliminate all that dead space.

image

Of course this presents a new problem. When you view this report now the white space is eliminated but, it appears that all row groups are at the same level, which would confuse an end user.

image

So I thought to do the obvious I’ll make each group and expression with some leading spaces to indent the second and third groups. I could have also used the SPACE function to simulate the problem I’m demonstrating as well.

="   "+Fields!Subcategory.Value

This works beautifully from the BIDS preview screen but once deployed to the Report Server those spaces are then truncated. This happens because the compresses the leading spaces for you automatically.

The workaround is to use a non truncating space character. By using the ASCII key code for 0160 you will get the spaced effect you’re looking for. So by holding Alt + 0160 on your number pad non truncating spaces will be added to your report expression. Do this the desired number of times on each group and your report will look great! By the way number pad was intentionally bolded here because if you’re working on your laptop make sure to turn on the number lock and use the appropriate number pad keys for this to work. The final report looks like this!

image


Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.