Monday, March 26, 2012

Reporting Services Report / Chart / Dynamically Hide-Unhide DataFields in a chart

Hello All,

I have a reporting services report in the form of a chart. I have two datafields on the chart.

I need to be able to dynamically hide one datafield and view the chart for the other one and vice versa.

How do I do this ?

Any help would be appreciated..

Thanks!

Take a look at the Visibility property. You can use it to hide or show items. The ToggleItem allows you to tie the visibility to another item.|||

Hello,

Thanks for your response. Can you explain to me how to use the visibility property on the DataFields (or) any links that would explain this would be helpful.

Thanks!

|||I'm sorry, I misread your original question. You can't hide a data field directly, but you can set the value for it to an empty string, which causes it not to show up in the chart. However, this won't remove the series label.|||

Hi,

if you don't need to see both fields at the same time you could do the following:

Just put one field into your chart. Rightclick the DataField in your chart and choose properties. Now you see the "Edit Chart Value" window. There you have "Series label:" and "Value:".

For the label use something like

=IIF(Parameters!ReportYear.Value = 2003, "Name of Field 1", "Name of Field 2")

For the value use

IIF(Parameters!ReportYear.Value = 2003, Sum(Fields!NameOfField1.Value), Sum(Fields!NameOfField2.Value))

Now you can start your report and only if you choose 2003 as year, you'll see the values of the first field.

sql

No comments:

Post a Comment