Using actions to structure the Product list

There is a way of displaying the Product list which combines the benefits of displaying the list hierarchically with the benefits of displaying the whole list.

The Product hierarchy has these levels:

  • All Products,
  • Product Group
  • Tire
  • Size
We will create a menu for users to select one of these levels. This will populate a variable with the value selected from the menu. The variable will be used in Structure Selection in the List Designer to determine which level of the hierarchy is displayed in the report. You can create variables in any of the report modes.
  1. In the Repository Explorer, click Accessories.
  2. Right-click the Global Variables folder and click New Global Variable.
  3. Specify the variable gv_ProductLevel2 and press Enter.
  4. Select gv_ProductLevel2 and click Properties in the toolbar of the Accessories pane.
  5. In the Advanced section of the Properties pane, specify [Product].[All] in the Value field and press Enter.
    [Product].[All] is now the value of the gv_ProductLevel2 variable. [Product].[All] is the unique name of the All Tires element of the Product list.
  6. In Design Mode, click the border of the Product hyperblock to enable the List Designer.
  7. At the bottom of the Structure Selection pane, delete Children of All Tires.
  8. Expand the Global Variables folder in Structure Selection.
  9. Right-click gv_ProductLevel2 and select Select as Level.
    This specifies that whichever level of the Product hierarchy is held in the gv_ProductLevel2 variable will be displayed in the report.

    In View Mode, only the figures for All Tires are displayed.

    The next step is to find a way to change the value held by the variable.

  10. In Design Mode, specify x in cell B9.
  11. Right-click B9 and select Define Action.
  12. Select Set Parameters from the Type list.
  13. Select =TRUE as the condition.
  14. In the Actions section, select Shortcut menu on left-click from the Mode list.
  15. Select User-defined string as the command text.
    The Edit Names and Texts dialog is displayed.
  16. In the Edit Names and Texts dialog, select All products. Click OK.
    Note: If the string All Products is not listed, click New Text and specify All Products.
  17. In the Parameters section of the Define Action dialog, double-click New Parameter.
  18. In the drop-down list, expand the Global Variables list and select gv_ProductLevel2.
  19. Click in the Value field and click the browse button.
  20. In the right-hand pane of the Edit Value dialog, replace =TRUE with ="[Product].[All]".
  21. Click OK.
  22. Click New Action in the Define Action dialog.
  23. Select Set Parameters from the Type list.
  24. Select =TRUE as the condition.
  25. In the Actions section, select Shortcut menu on left-click from the Mode list.
  26. Select User-defined string as the command text.
  27. Select Product Group from the Texts dialog.
    Note: If the string Product Group is not listed, click New Text and specify Product Group.
  28. Double-click <New Parameter> and select the gv_ProductLevel2 variable. Specify the value of the parameter as ="[Product].[Product Group]".
  29. Repeat the steps 20 to 24 to create a third and fourth action. For these actions, select Tire and Size in the Texts dialog and set the gv_ProductLevel2 variable to ="[Product].[Tire]" and ="[Product].[Size]" respectively.
    Note: If the strings Tire and Size are not listed, click New Text and specify Tire. Then click New Text and specify Size.
  30. Click OK to close the Define Action dialog.
  31. In View Mode, click x to display the list of levels. The data changes according to the level you select.
  32. Save the report and then create a copy called Tutorial5.