416.467.9100 | Dundas Data Visualization | Login
Welcome Guest
Dashboard v5.0

This site makes extensive use of JavaScript.

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

Passing Parameters Between Dashboard And DashBlock Viewer

Hide navigation
RSS
Modified on Wed, 19 Mar 2014 11:04 AM Categorized as DashBlocks, Parameters, Scripting
Dundas Dashboard Script LibraryPrevious

Overview

This article shows how to pass values between a Dashboard and a DashBlock, which is displayed on the same Dashboard using a DashBlock Viewer.

Passing the X-Axis (Date) label to the DashBlock Viewer

Suppose that in your Dashboard, you have a Bar Chart and a DashBlock Viewer, and you want to pass the X_Axis label (e.g. Date) to the DashBlock inside the DashBlock Viewer. The Target parameter on the DashBlock is named 'DateParam':

When a user clicks on the Bar Chart, the X-Axis label (i.e. Date) will be passed to the 'DateParam' parameter inside the DashBlock Viewer.

When a user clicks on the Bar Chart, the X-Axis label (i.e. Date) will be passed to the 'DateParam' parameter inside the DashBlock Viewer.


Bar Chart Click Interaction Script: The code below will allow the Bar Chart's X-Axis label to be passed on to the Date parameter in the DashBlock Viewer. Add the script in the Bar Chart's Click Interaction.

if (e.DataPoint != null) { DateTime dt1 = e.GetDataPointAxisValue(); ParameterInfoCollection params = new ParameterInfoCollection(); ParameterInfo param;

param = new ParameterInfo(); param.ParameterName = "DateParam"; param.GrainLevel = e.GrainLevel; // Create a new filter object DashboardFilterValueData fvd = new DashboardFilterValueData(); DashboardMemberValueData mvd = new DashboardMemberValueData(); // Set the new filter value mvd.Values.Add(dt1); mvd.ReadableValues.Add(dt1.ToString()); mvd.DateTimeGrain = DateTimeGrain.Day;

// Add the member object to the filter fvd.MemberValues.Add(mvd);

param.FilterValues.Add(fvd); params.Add(param); //Open the Target Dashboard and pass the ParameterInfoCollection DashBlockViewer1.SetParameters(params); }



Result after clicking the Bar Chart.

Result after clicking the Bar Chart.


Passing the DashBoard's parameter to the DashBlock Viewer

Suppose that in your Dashboard, you have a Bar Chart and a Date parameter, and and you want to pass the Date parameter to the DashBlock inside the DashBlock Viewer. In this sample, the Dashboard's Date parameter is named 'SourceDate', and the target parameter on the DashBlock is named 'DateParam':

When a user clicks on the Button, the value of the Dashboard's Date parameter will be passed to the 'DateParam' parameter inside the DashBlock Viewer.

When a user clicks on the Button, the value of the Dashboard's Date parameter will be passed to the 'DateParam' parameter inside the DashBlock Viewer.


Button Click Interaction Script: The code below will allow the Bar Chart's Date Parameter value to be passed on to the Date parameter in the DashBlock Viewer. Add the script in the Button's Click Interaction.

ParameterInfoCollection params = new ParameterInfoCollection(); ParameterInfo param;

param = new ParameterInfo(); param.ParameterName = "DateParam"; param.GrainLevel = SourceDate.GrainLevel; param.FilterValues = SourceDate.FilterValues; params.Add(param); //Pass the ParameterInfoCollection DashBlockViewer1.SetParameters(params);



Result after clicking the Button.

Result after clicking the Button.


Passing the DashBlock's parameter to the DashBoard

Suppose that in your Dashboard, you have a Bar Chart and a Date parameter, and and you want to pass the Date parameter from the DashbBlock Viewer to the DashBoard. In this sample, the Dashboard's Date parameter is named 'TargetDate', and the source parameter on the DashBlock is named 'DateParam':

When a user clicks on the Button inside the DashBlock Viewer, the value of the DashBlock's Date parameter will be passed to the 'TargetDate' parameter on the DashBoard.

When a user clicks on the Button inside the DashBlock Viewer, the value of the DashBlock's Date parameter will be passed to the 'TargetDate' parameter on the DashBoard.


Button Click Interaction Script: The code below will allow the DashBlock's Date Parameter value to be passed on to the Date parameter in the parent DashBoard. In the DashBlock, add the script in the Button's Click Interaction. Note that the script will not work on DashBoard Preview.

ParameterInfoCollection params = new ParameterInfoCollection(); ParameterInfo param;

param = new ParameterInfo(); param.ParameterName = "TargetDate"; param.GrainLevel = DateParam.GrainLevel; param.FilterValues = DateParam.FilterValues; params.Add(param); services.SetCurrentParameters(params,services.ParentDashboard);



Result after clicking the Button inside the DashBlock Viewer.

Result after clicking the Button inside the DashBlock Viewer.


Related Topics


Click to return to: Documentation

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

Copyright © 2009-2014 Dundas Data Visualization, Inc.