all groups > sql server reporting services > april 2007 >
You're in the

sql server reporting services

group:

Customizing report columns count at runtime


Customizing report columns count at runtime mblishch
4/30/2007 2:15:37 AM
sql server reporting services: Hello all. In my application I have some rdl file that determines
general look of my report. Also I have a table that has 20 columns I
have stored proc that returns dataset that also has 20 columns but may
have filled less than 20 columns (5 for example). The problem is how
to hide another (20-n) columns.
Now I simply pass params to report and hide columns according to these
params.In this case I have normally rendered report on screen and I'm
experiencing problems with printing: I have my "n" columns printed
normally then long space and table end line ( in another printed
page ) what looks ugly.
So my question is: can I dynamically manage columns count ( without
having to generate rdl programatically :) ), for example pass report
param "ColumnsCount" and then have so much columns as I want (also
apply binding values for these columns)
or
is there a method how to hide my (20-n) columns and minimize table so
I do not have that big white space and ugly line after it.

Any ideas?
Thanks in advance
Re: Customizing report columns count at runtime EMartinez
4/30/2007 5:34:51 AM
[quoted text, click to view]


You should be able to toggle visibility of the columns in the report
via an expression. Right-clicking the column in the table control and
selecting properties and select the tab for visibility and then enter
an expression that checks for the sum of the column's value. Something
like this should work:
=iif(Sum(Fields!ColumnItemX.Value) > 0, "true", "false")
Also, you might want to make sure that for individual cells, the
shrink to fit (or similar wording) is selected and that you
conditionally set border styles based on if the column is visible
(via, Properties -> Border Style: =iif(Sum(Fields!ColumnItemX.Value) >
0, "Solid", "None"))
Hope this helps.

Regards,

Enrique Martinez
Sr. Software Consultant
AddThis Social Bookmark Button