In this article
The Hierarchy control enables the viewer to filter reports on a hierarchy question. You can add for example a hierarchy, a result table and a Refresh button to a report page such that the viewer can select a particular item in the hierarchy and refresh the table to see the results only for the selected hierarchy item.
The following is an example of how you can set up a hierarchical filter:
Note: The report in this case must be based on a questionnaire that includes a hierarchy question.
- Create the report and/or report page as required.
- Add a Parameter to the report (go to Parameters Overview for more information).
- Right-click on the parameter and select Properties.
- Set the Type to String Response, save, and close the Properties page.
- Double-click on the parameter or right-click and select Edit to open the Parameter Designer page.
- Drag the hierarchy question from the Data Source toolbox and drop it into the "Drop a Question Here" area in the Parameter Designer.
- Save the changes.
- In the Report toolbox, double-click on the report page on which you wish to place the hierarchy, to open the Page Editor for that page.
- Create an HTML table on the page as required.
- Drag a Hierarchy element from the Visual Components toolbox and drop it onto the page, then save the changes.
- In the Report toolbox, drag the parameter that you created earlier, into the Hierarchy element on the report page, then save the changes.
- In the Filters toolbox, right-click on the Filters folder and select Insert Filter Expression, then rename the filter as appropriate.
- Double-click on the filter to open the Filter Expression Designer page, then in the filter, type the expression:
- Save the changes and return to the report Page Editor.
- From the Visual Components toolbox, drag a Button component into the report page.
- Double-click on the button element to open the button's Parameters page, and set the Target Page property to the page on which the result table/chart is to be displayed.
- Select a Style for the button and type into the Label field the text you wish to appear on the button, for example Refresh.
- Click Apply or Apply and Close, then save the changes.
- Create the result table and/or chart on the required report page.
The parameter's Properties page opens.
The Data Source ID and Question ID of the Hierarchy question appear in the Parameter Designer.
hierarchyQuestionId = PValStr("parameterId")
This will enable the viewer to refresh the page after using the filter.