416.467.9100 | Dundas Data Visualization | Login
Welcome Guest
This is the support page for the legacy Dundas Dashboard application. For assistance with the current Dundas BI application please click here.
Dashboard v5.0

This site makes extensive use of JavaScript.

Please enable JavaScript in your web browser and reload the page before proceeding.

Filter multiple parameters using a single parameter control

Hide navigation
RSS
Modified on Wed, 12 Mar 2014 11:37 AM Categorized as Chart, Data Controls, Data Grid, Filtering, Level-Intermediate, Parameter Controls, Parameters, Script Library, Scripting

Overview

This article will demonstrate how to use the CopyValuesTo and CopyFilterValuesTo methods to filter data controls by copying values from a source parameter to a target parameter. These provide quick methods to script a parameter and copy its values from one parameter to another avoiding complex scripts. The target parameter's filter values get overwritten.

This can be used when only one parameter control is displayed on the canvas and its value is passed to multiple parameters and filter multiple controls at the same time.

Both methods belong to the DashboardParameter class.

In the example used in this article, the selection of the bar chart parameter, Parameter_BarChart (Source parameter), is copied to the data grid parameter, Parameter_DataGrid (Target parameter), and filters both the controls at the same time.

CopyValuesTo

Copies the parameter values to the target parameter.

The CopyValuesTo method uses the following arguments:


CopyFilterValuesTo

Copies the filter values to the target parameter.

The CopyFilterValuesTo method uses the following arguments:




Setup

  • Create a dashboard and setup a bar chart and a Data Grid both having a filter of the same type on their respective KPI/Datasets. In this example, the filter is of string datatype and is on the Region column.
  • Create two parameters to filter the data on both the controls:
    Parameter_BarChart: Filters the Bar Chart (First control). This will be a parameter dropdown list.
    Parameter_DataGrid: Filters the DataGrid (Second control). This will be a parameter dropdown list.

  • Drag and drop the Parameter_BarChart parameter on the canvas. Default is set to “All Values”.
  • Drag and drop the Parameter_DataGrid parameter on/off the canvas. In this example, it's placed on the canvas. Default is set to “All Values”.

Parameter Changed Interaction

In the Parameter Changed Interaction of the dashboard, add the following script to copy the values from the Parameter_BarChart parameter to the Parameter_DataGrid parameter using the CopyValuesTo and CopyFilterValuesTo methods.

//Source Parameter: Parameter_BarChart //Target Parameter: Parameter_DataGrid

if(e.Parameter.Name=="Parameter_BarChart") { //Use one of these options:

//Option 1: Using CopyValuesTo method Parameter_BarChart.CopyValuesTo(Parameter_DataGrid);

//Option 2: Using CopyFilterValuesTo method Parameter_BarChart.CopyFilterValuesTo(Parameter_DataGrid); //Invalidate the filter Parameter_DataGrid.InvalidateFilter(); }


Result

Before changing the Parameter_BarChart parameter, both the parameters are set to their respective default values:

Image

After changing the Parameter_BarChart parameter to Region A, the Parameter_DataGrid parameter changes immediately due to the script and filters both the controls:

Image

After changing the Parameter_BarChart parameter to Region C, the Parameter_DataGrid parameter changes again and filters both the controls:

Image

Related Topics

About Dundas | Contact Us Follow us on Twitter! | Privacy Statement | Report Site Issues

Copyright © 2009-2014 Dundas Data Visualization, Inc.