Export (0) Print
Expand All

Lesson 4: Adding a Boolean Parameter to Control the Initial Drilldown State

SQL Server 2005

New: 17 July 2006

Drilldown reports can be expanded or collapsed to show or hide summary or detail data. A drilldown report displays a toggle (+) for any summary group, row, or column for which the Visibility properties (Hidden and ToggleItem) are set. You set the Visibility properties on groups, rows, and headers to achieve this effect. The Resellers Worldwide report you created in Lesson 1 includes a drilldown action on the table group header. The report opens by default with the detail data collapsed. Only the table group header summaries appear until you expand the toggles to see the detail rows.

In this lesson, you will define a Boolean report parameter called ShowSalesDetails that allows report readers to set the initial drilldown state of the report. You will set the Hidden element of the Visibility property on the table detail row of the Order Date and Sales Order Number columns using this parameter. When report readers set ShowSalesDetails to true, they see the expanded report with all detail data when the report opens.

  1. In SQL Server Business Intelligence Development Studio, open the Advanced Parameters Tutorial report server project if it is not already open.

  2. In Solution Explorer, double-click on the Resellers Worldwide report. The report opens in Layout view.

  1. On the Report menu, click Report Parameters. The Report Parameters dialog box opens.

  2. Click Add. A report parameter with default values is created.

  3. In the Properties section, in the Name text box, type ShowSalesDetails.

  4. From the Data type drop-down, select Boolean.

  5. In the Prompt textbox, type Show Sales Details?.

  6. Verify that all check boxes are unselected.

  7. In the Available values section, select Non-queried. Leave the values blank.

  8. In the Default values section, select Non-queried. In the text box, type =False.

  9. Click OK.

  10. (Optional) Click the Preview tab. Verify that the parameter appears with radio buttons to select True or False on the report toolbar.

  1. Click the Layout tab to change to Layout view.

  2. Click inside the table to show the table handles.

  3. Right-click on the bottom detail row handle.

  4. From the shortcut menu, select Edit Group. The Grouping and Sorting Properties dialog box opens.

  5. Verify that the name of the group is table1_Details_Group.

  6. Click the Visibility tab.

  7. Under Initial Visibility, click Expression. Paste the following expression in the textbox.

    =Not(Parameters!ShowSalesDetails.Value)

    When ShowSalesDetails is true (you want to see all the data), the Hidden property needs to be False (don't hide the data).

  8. Verify that Visibility can be toggled by another report item is selected, and that Store appears in the Report Item drop-down list.

  9. Click OK.

  10. Click Preview. To verify that the parameter works as expected, select territory group North America, change the value of the ShowSalesDetails parameter and click View Report.

You now need to set the initial state of the toggle image (+ or -) to correspond to the expanded or collapsed settings.

  1. Click the Layout tab to change to Layout view.

  2. Click inside the table to show the table handles.

  3. Click in the Store group header text box. The value of the Store text box begins with =Fields!Store.Value.

  4. From the Properties window, scroll to the InitialToggleState property. The default display value is Collapsed. InitialToggleState, however, is a Boolean property, so you need to set the property to an expression that evaluates to True or False.

  5. Click in the text box, and from the drop-down list, select <Expression>. Replace the text Collapsed with the following expression:

    =Parameters!ShowSalesDetails.Value
    

    The toggle image (+ or -) indicates the action that will happen when you click on the toggle. When the toggle shows a plus sign (+), the information is collapsed and will expand when you click on it. When the toggle shows a minus sign (-), the information is expanded and will collapse when you click on it. So + is used for the collapsed state (false) and - used for the expanded state (true). The expanded state shows all the sales order details, so you can use the actual parameter value for ShowSalesDetails to be the value for the InitialToggleState.

  6. Click Preview. To verify that the parameter works as expected, change the value of the ShowSalesDetails parameter and click View Report.

You can use the ShowSalesDetails parameter to control visibility for more than one report item. In the next procedure, you will set the visibility of the Order Date and Sales Order Number columns to the same ShowSalesDetails parameter.

  1. Click the Layout tab to change to Layout view.

  2. Click inside the table to show the table handles.

  3. Click the Order Date column header.

  4. Hold down the CTRL key and click the Sales Order Number column header. Two columns are selected.

  5. From the Properties window, scroll to the Visibility property.

  6. Click the plus sign (+) to expand the Visibility property. The properties Hidden and ToggleItem appear.

  7. From the Hidden property drop-down list, select Expression. The Edit Expression dialog box opens.

  8. Paste the following expression in the expression pane: =Not Parameters!ShowSalesDetails.Value

    When ShowSalesDetails is true (you want to see all the data), the Hidden property needs to be False (don't hide the data).

  9. Click OK.

  10. Click Preview. The report opens showing just the columns for Store and Total Due.

You have successfully created a Boolean parameter that controls the visibility of table detail rows and two table columns. In the next lesson, you will add a subreport that displays reseller contact information. See Lesson 5: Adding A Report Parameter to Pass to a User-Defined Function.

Community Additions

ADD
Show:
© 2014 Microsoft