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.

Pass date value during drill down from one dashboard to another

Hide navigation
RSS
Modified on Wed, 16 Apr 2014 04:58 PM Categorized as Chart, Data Grid, Script Library, Scripting

Overview

This article will show how you can pass a date during drill down from one dashboard to another. When the interaction wizard is used during drill-down, only the start date is passed. Since there is no end date, the control on the target dashboard does not get filtered and will show up as blank. Therefore, the end date needs to be added as another MemberValue to the date parameter and invalidate the filter.

Setup

This example shown here will use a BarChart with DateTime scale on the source dashboard. Clicking on a datapoint will pass the associated date value to the parameter on the target dashboard and filter the DataGrid control on it.

Source Dashboard - Bar Chart

Source Dashboard - Bar Chart


Target Dashboard - DataGrid

Target Dashboard - DataGrid


The example takes the date on click from the source dashboard and stores it in a global variable, Date_Source. On the target dashboard’s Load Interaction, the date is retrieved from the global variable and is added as a new MemberValue as the end date. The start date is passed during the services.NavigateToDashboard method. A second global variable, isDrillDown is used as a flag to check whether the target dashboard is loaded by a drill down or if it’s loaded separately.

Note: This example uses a Calendar Range control on the target dashboard. Same setup applies even if a single Calendar control is used. This is because the Calendar control still looks for an end date and if not passed, it will not filter the data.

Source Dashboard

Place this code in the Click Interaction of the Bar Chart:

if (e.DataPoint != null) { ParameterInfoCollection params = new ParameterInfoCollection();

ParameterInfo param;

param = new ParameterInfo(); param.ParameterName = "paramDate_Target"; param.GrainLevel = e.GrainLevel; param.FilterValues.Add(new DashboardFilterValueData()); if (e.DataDescriptor.Dimensions.Count > 0) { Collection keyValues = e.GetDataPointKeyValuesFromColumnId("1054c84c-03ed-476c-a6be-670182294df8"); if (keyValues.Count > 0) { param.FilterValues.Clear(); DashboardFilterValueData filterData = new DashboardFilterValueData(); param.FilterValues.Add(filterData); DashboardMemberValueData memberData = new DashboardMemberValueData(); filterData.MemberValues.Add(memberData); if (e.GrainLevel >= 0) { memberData.HierarchyLevel = e.GrainLevel; } foreach (object key in keyValues) { memberData.Values.Add(key); }

memberData.Text = e.GetDataPointKeyCaptionFromColumnId("1054c84c-03ed-476c-a6be-670182294df8"); } } params.Add(param); //Set flag to check if the Target dashboard is loaded via drill down or on its own services.Globals"isDrillDown" = 1; //Pass the datapoint value to the global variable services.Globals"Date_Source"=e.GetDataPointAxisValue(); services.NavigateToDashboard("f12811a1-7cee-42a4-8729-e33cd6dcaaf4",params); }

Target dashboard

Place this code in the Load Interaction of the target dashboard:



//Retrieve the value from the global variable int isDrillDown = new int; isDrillDown = services.Globals"isDrillDown";

//Retrieve the Date that was clicked DateTime date = new DateTime; date = services.Globals"Date_Source";

//Make sure the end date goes to 11:59:59 PM to cover the entire day date = date.AddDays(1).AddTicks(-1);

if(isDrillDown) { //Add the end date as a new member value DashboardMemberValueData mvd = new DashboardMemberValueData(); mvd.Values.Add(date); //A Token can also be added //mvd.NamedTokenValue = NamedToken.CurrentYearEnd; paramDate_Target.FilterValues0.MemberValues.Add(mvd); //Invalidate the filter paramDate_Target.InvalidateFilter(); }



Result

The DataGrid on the target dashboard is filtered by the clicked date:

Filtered DataGrid

Filtered DataGrid


Related Topics

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

Copyright © 2009-2014 Dundas Data Visualization, Inc.