Using actions to structure the Product list

We can display the Product list in a way that combines the benefits of displaying a hierarchical list with the benefits of displaying the whole list.

The Product hierarchy has these levels:

  • All Products,
  • Product Group
  • Tire
  • Size

We can create a menu for users to select one of these levels. This populates a variable with the value that is selected from the menu. The variable can then 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.

First, in steps 1 and 2, we undo the changes that we made in the list designer in Tutorial3.

  1. In Design mode, click the border of the Product hyperblock.
  2. In Structure Selection, select Children of All Tires and click Delete. Apply the changes to the list.
  3. In the Application Explorer, click Accessories.
  4. Perform one of these tasks:
    Option Description
    Create a global variable to hold the product level Right-click the Global Variables folder and select New Global Variable. Specify a name for the variable.
    Use the existing gv_ProductLevel2 variable Expand the Global Variables folder and locate gv_ProductLevel2.
  5. Click in the column to the right of the product level variable and press the F2 key to make the field editable. Specify [Product].[All] and press Enter.
    [Product].[All] is now the value of the product level 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. Expand the Global Variables folder in Structure Selection.
  8. Right-click the product level variable and select Select as Level.
    This specifies that whichever level of the Product hierarchy is held in the product level variable is displayed in the report.

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

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

  9. In Design mode, specify x in cell B9.
  10. Right-click B9 and select Define Action.
  11. Select Set Parameters as the type.
  12. Select =TRUE as the condition.
  13. Select Shortcut menu on left-click as the mode.
  14. Select User-defined string as the command text.
    The Edit Names and Texts dialog box is displayed.
  15. In the Edit Names and Texts dialog box, select All products in the English column. Click OK.
    Note: If the string All Products is not listed, click New Text in the toolbar and specify All in the English column.
  16. In the Parameters section of the Define Action dialog box, click Add parameter and select the product level variable from the list of global variables.
  17. Click =TRUE in the Value field and click the browse button.
  18. In the right-hand pane of the Edit Value dialog box, replace =TRUE with ="[Product].[All]".
  19. Click Add action in the Define Action dialog box.
  20. Select Set Parameters as the type.
  21. Select =TRUE as the condition.
  22. In the Actions section, select Shortcut menu on left-click as the mode.
  23. Select User-defined string as the command text.
  24. Select Product Group from the Texts dialog box.
    Note: If the string Product Group is not listed, click New Text and specify Product Group in the English column.
  25. Click Add parameter and select the product level variable. Specify the value of the parameter as ="[Product].[Product Group]".
  26. Create third and fourth Set Parameters actions. For these actions, select Tire and Size in the Texts dialog box and set the product level 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.
  27. Click OK to close the Define Action dialog box.
  28. In View mode, click x to display the list of levels. The data changes according to the level you select.
  29. Save the report and then create a copy called Tutorial5.