This topic describes how to use a parameter as a free form text input filter control. In this use case, the user enters a value that interacts with and controls the visualization's top N value.
Use Case Description
A Top Bottom N filter's value is set when the visualization is created. You can now use a parameters as a free form text input filter control where the user can select a Top N value to change the data that is displayed in the visualization.
This use case uses the Sample Order Line dataset.
The steps for this use case are:
Create the Visualization
To start this use case, create or open a workbook and add a horizontal bar chart that has Cities on the X-axis and Sale on the Y axis.
Create the Parameter
Go to the workbook's Parameters tab to create the parameters required for this use case.
- In Name, enter Top N.
- In Data Type, select Integer.
- In Allow Multiple Values, leave it set to Off because the parameter will be used as a single-entry filter.
- In Alias, leave it set to Off.
- In Possible Value Type field, select Any.
- In Initial Value, select Value and enter 10.
- Click OK to save the parameter.
Create the Expression Filter
In the expression, the Rank function calculates a rank for each row within a result set, and the operator <= limits the value returned by the parameter Top N, which uses a default value of 10.
- Confirm that the visualization's Grammar panel is displayed.
- Scroll to the Filters area, click Drop Target Options, and select Add Expression Filter.
- In Label, enter Top N.
- In the Expression field, compose this
- Click Validate, and then click Save to save the calculation.
- In the filter bar, right-click the Top N filter and clear Show Filter to hide the filter.
Add the Parameter as a Filter Control on the Canvas
- Click the workbook's Visualization tab and scroll to the Dashboard Controls section.
- Drag and drop the Dashboard Filters control to the canvas.
- Click the workbook's Parameters tab.
- Drag and drop the Top N to the grammar panel's Filter Controls area.
- Click Save to save the workbook.