This document explains how to filter dashboard data using parameter variables. We will create 2 combo boxes to set up a parameter start and end date. By changing the value of these parameters, we will be able to apply a filtered query to our database.
Prerequisite
We need to have two parameters in the worksheet allowing us to define a start and end date. In our case they are called StartDate and EndDate.
Steps
- Create two combo boxes allowing the user to select a start and end date. We will call them ComboBoxStart and ComboBoxEnd. Select Embedded as list values type and check the calendar option.
- Go to the dashboard Options and go to the Script tab.
- Let’s create a script that initializes these two combo boxes. For instance:
- End date = today
- Start date = today - 3 days
For this we can use the following javascrit code:
ComboBoxStart.selectedObject = dateAdd('d', -3, new Date());
ComboBoxEnd.selectedObject = new Date();
refreshData();
- Let’s now add a script in the onRefresh case, in order to adjust the query depending on the user selection.
parameter.StartDate = ComboBoxStart.selectedObject;
parameter.EndDate = ComboBoxEnd.selectedObject;
refreshData();
- Create a simple table or line chart and test if the filter applies correctly
- Create a combo box chart by dragging it into the screen.
- Set up the list of values of the combo box.
- Take note the name of the combo box (right click on the combo box and click on Properties). You can of course change the default name.
- Right click on the chart you want to hide/show and click on the Properties button
- Set the properties Visible as follows: =parameter.ComboBoxName == ‘VALUE_TO_SHOW’
...


