Dela via


Hiding Report Items Conditionally

You can control whether a report item initially displays or is hidden when a user views a report. By providing a toggle on a text box, you can enable users to hide and display items interactively. For a table or matrix, you can show or hide static rows and columns, or rows and columns that are associated with groups. The main reason for hiding items is to provide a report that shows summary data but enables a user to drill down into detail data.

For example, you can initially hide all the rows except the outer group summary row for a table with row groups. For each inner group (including the details group), add a toggle to the grouping cell of the containing group. When the report is rendered, the user can click the text box to expand and collapse the detail data. For more information, see Adding a Table (Reporting Services).

Note

When you create a drillthrough report, the visibility information must be set on the group, column, or row that you want to hide, not just a single text box in the row or column. In addition, the text box that use you for the toggle must be in a containing scope that controls the item that you want to show or hide. For example, to hide a row associated to nested group, the text box must in a row associated with the parent group or higher in the containment hierarchy.

For step-by-step instructions about hiding report items, see the following topics:

Drillthrough Reports

A drillthrough report enables a user to click a link for a summary value and open a separate, related report to show detail data. The detail data is only retrieved when the detail report runs. Drillthrough reports typically require fewer resources than drilldown reports. For more information, see Adding Drillthrough Reports and Tutorial: Adding Parameters to a Report.

Hiding Columns for Missing Dataset Fields at Run time

For dataset field collections that change during run time, you can set an expression for column visibility so that only those fields that exist in the run-time result set are displayed in the report. Columns for missing fields are not rendered and take up no space in the report. Testing for the presence of a field at run time requires custom code. For more information, see Using Dataset Fields Collection References in Expressions (Reporting Services).

Rendering Extension Support for Hidden Report Items

The show-and-hide toggle on report items is supported only by rendering extensions that support user interactivity, such as the HTML rendering extension. Other rendering extensions display hidden items. The following list describes support for report items with conditional visibility:

  • The HTML rendering extension does not display hidden items; hidden items are not visible even in the HTML source.

  • The XML rendering extension displays all report items, regardless of whether they are hidden.

  • The Excel rendering extension displays and expands hidden rows and columns for a table, matrix, or list. All rows and columns are visible.

For more information, see Understanding Rendering Behaviors.