Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

Image Added

Steps

  • Create two combo boxes allowing the user to select a start and end date. We will call them ComboBoxStart and ComboBoxEndSelect Embedded as list values type and check the calendar option.

Image Added

  • Go to the dashboard Options and go to the Script tab.

Image Added

  • 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();

Image Added

  • 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();

Image Added

  • Create a simple table or line chart and test if the filter applies correctly
  1. Create a combo box chart by dragging it into the screen.Image Removed
  2. Set up the list of values of the combo box.
  3. 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.Image Removed
  4. Right click on the chart you want to hide/show and click on the Properties button
  5. Set the properties Visible as follows: =parameter.ComboBoxName == ‘VALUE_TO_SHOW’

...