Using actions to restructure a list

This example uses the Product hierarchy.

The Product hierarchy has three levels. These are All Tires, Tire, and Size. We will create a shortcut menu containing these three levels. We will populate a variable with the value selected from the shortcut menu. The variable will be used to determine which level of the hierarchy is displayed in the report.

You can create global variables in any of the report modes.

You can create report variables only in Design Mode.

  1. Create a report.
  2. In the Repository Explorer, open the Accessories pane. Right-click the Global Variables folder and select New > Global Variable.
  3. Name the variable gvProductLevel and press Enter.
  4. Assign [Product].[All] as the value of the variable. This is the unique name of the All Tires element.
  5. Drag the Product dimension of the SALES cube from the Database Structure into the report to create a hyperblock. Create an OLAP formula in the value cell.
  6. Select the hyperblock and select Structure Selection in the List Designer. Expand the Global Variables folder.
  7. In the Global Variables folder, right-click gvProductLevel and select Select as Level.

    The level of the Product hierarchy which is stored in the gvProductLevel variable, is displayed in the report.

    In View Mode, only the figure for All Tires is displayed.

    The next stage is to find a way to change the value stored by the variable.

  8. In Design Mode, enter Click Me in a cell near the Product hyperblock.
  9. Right-click and select Define Action.
  10. Select Set parameters from the Type list.
  11. Select=TRUE as the condition.
  12. In the Actions section, select Shortcut menu on left-click from the Mode list.
  13. Select User-defined string as the value of the Command Text input. This opens the Texts dialog. Scroll down and highlight All Products. Click OK.
  14. In the Parameters section, double-click <New Parameter>.
  15. Expand the Global Variables list and select gvProductLevel.
  16. Click Browse in the Value field to open the Edit Value dialog box.
  17. In the Edit Value dialog box, delete =TRUE and specify ="[Product].[All]" in its place.
  18. Click OK.
  19. Click <New Action> in the Define Action dialog box and, in the same way, create a second Set Parameters action. This time select Tire from the Texts dialog box and set the value of gvProductLevel’ to ="[Product].[Tire]".
  20. Create a third action. Select Size in the Texts dialog box and set the value of gvProductLevel to ="[Product].[Size]".
  21. In View Mode, click Click Me. Products at a different level of the hierarchy are displayed according to the level you select in the shortcut menu.