Partager via


How to click in a report to show/hide (toggle) multiple items

Many people want the user to be able to click an area of a report and have items in the report be shown based on this interaction.

For example, I might want to toggle between a table view and a chart view of some data.

The way to do this is to use a report parameter in combination with a drill-through link back to the same report. Once you have this infarstructure, you can use an expression to drive the 'Hidden' property of a report item.  If you have one or two items to show/hide you can probably do this inline.

However, if you have many items, the logic is complex, or the logic needs to be repeated across reports, it would be better to centralize the logic so you can better maintain your reports.

The way to do this is to put your visibility expression in a function.  You can then call the function using the Code.FunctionName syntax where you normally would have put your visibility expression.

You can take a look at this example to see how it can be done.  First add yourself to the lukaszpblog group on https://groups.msn.com/lukaszpblog.  Then click the link: Sample RDL

Take care, and best luck