Monday, March 10, 2014

SSRS group toggle visibility show initially as expanded, but shows plus sign instead of minus

SQL Server 2008 R2

Problem

A report with mulitple row groups is defined to toggle opened or closed. The requirement is to show the report with the groups initially shown as expanded. This works fine, but the toggle sign is shown counterintuitively as a plus (+) sign and not as the minus (-) sign.

The child groups and detail sections are setup to be shown with a toggle item that is referring to the parent group.

Typically a report with the detail expanded, is shown with (+) sign as toggle. From the (+) sign you would expect to expand the details, instead when clicking it, it will collapse.

image

Solution to initially show toggle item expanded with minus (-) sign

In hte example there are 3 group levels: country – region – zone, distinguished by the fields CountryName, RegionName, ZoneName. The basic toggle setup is as follows:

  • In Visual Studio 2008 report design, select the tablix with the report groups
  • In the row group pane, open the DetailsGroup rowgroup dropdown and select ‘Group properties…’
    image
  • In the Group Properties dialog window, in the left hand pane, select ‘Visibility’. In the right hand pane, the ‘Change display options are shown.
  • Select the radio button option ‘Show’
  • Check ‘Display can be toggled by this report item option’ and select the name of the parent group field, in this case ‘ZoneName’.
    image
  • Clcik OK to accept the change and close the dialog.
  • The same is done for the rowgroup with the ZoneName. Open the Group properties dialog, set option to show, check and select the parent groupt report item ‘RegionName’.
  • The same is done for the RegionName rowgroup, set to ‘CountryName’.

At this stage we have a report that opens expanded as shown in the introduction, with a (+) sign instead of (-)sign.

The next step is to set the InitialToggleState of each toggle report item to True.

  • In the tablix, select the textbox with the toggle item ‘ZoneName’.
  • In the Properties window of Visual Studio (NOT in the ‘Text Box properties… dialog window when one rightclicks on a textbox), scroll down to the InitialToggleState and set this property to True.
    image
  • Do the same for the textbox with the RegionName and CountryName.
  • Save the report and preview it. Now it will show items expanded with a (-) sign.
    image

Conclusion

On reports with several group levels, for which you want to toggle expand and show the report initially expanded but with (-) sign in front of the toggle report item, set the InitialToggleState property of the report item to True.

No comments: