Can I get the selected column hierarchy members?

Hello, I’m a beginner of Dundas BI’s scripting, it’s the first time to post.

I’m making a table with drill-through by scripting (not with “Navigate” function because the table uses Dynamic Hierarchies), and I encountered the problem shown below.

I can get the selected row hierarchy members with the function “getSelectedRowHierarchyMembers”, but I don’t know how I can get the selected column hierarchy members.

For example below, when the blue cell is clicked, can I get “Continent is Europe” and “Country is France”?

image

Hi Yutaka,

You can get the selected column hierarchies with getSelectedColumnOrdinals method similarly, which provides the ordinals that you can use on the cellset similar to the script library example below.

https://www.dundas.com/support/developer/script-library/data/get-click-or-interactive-data

On this script library sample (which is the same for all visualizations); the script action’s arguments provide the ordinals indicating which row & column was clicked, which you can use to index the cellset’s rows and columns. The cellset is provided in a standard way.

As a side note, we do not recommend using script for drilling down with a dynamic hierarchy. Although, it would work, this is one of the limitations with Dynamic Hierarchies, which is also mentioned here,

For your information, we have Advanced Training Courses available, in case you’d be interested. To discuss this further, you may contact your Customer Success Advisor.

Hi Azar-san,
Thank you for your excellent answer and the example page!
I didn’t know I can get the whole table info (cellset) from the event object (e).
The example shows me all I wanted to know, and I’ve implemented them.

About your advice below:

As a side note, we do not recommend using script for drill down with a dynamic hierarchy, …

is it also true for drill-through (jump to another data table that shows detailed records)?
I made a flexible table with dynamic hierarchies. And since I noticed that it is impossible to drill-through with “Navigate” function, I posted this question. (And it seems that I have successfully implemented it. )

Hi Yutaka,

You are very welcome!

Regarding your question, I’m afraid to say that, this is not supported either and it may not work properly.

I understand the reason why it’s not recommended.
I’ll reconsider my implementation when I make the next version of my dashboard.

1 Like

Finally, I made a drill-through function with the following code. Thanks!

//
// Get info of clicked row and column
//
var cellset = e.relatedData.metricSetBinding.dataResult.cellset;
var rowOrdinal = e.relatedData.rows[0];
var rowHierarchyName0 = cellset.rows[rowOrdinal].members[0].hierarchyUniqueName;
var rowHierarchyName1 = cellset.rows[rowOrdinal].members[1].hierarchyUniqueName;
var rowHierarchyValue0 = cellset.rows[rowOrdinal].members[0].caption;
var rowHierarchyValue1 = cellset.rows[rowOrdinal].members[1].caption;
var colOrdinal = e.relatedData.columns[0];
var colHierarchyName0 = cellset.columns[colOrdinal].members[0].hierarchyUniqueName;
var colHierarchyName1 = cellset.columns[colOrdinal].members[1].hierarchyUniqueName;
var colHierarchyValue0 = cellset.columns[colOrdinal].members[0].caption;
var colHierarchyValue1 = cellset.columns[colOrdinal].members[1].caption;
var navigation = new dundas.view.NavigateAction();
//
// Make query string
//
var queryString = “”;
if (rowHierarchyValue0 !== “(All)”)
queryString += “&$” + rowHierarchyName0 + “=” rowHierarchyValue0;
if (rowHierarchyValue1 !== “(All)”)
queryString += “&$” + rowHierarchyName1 + “=” rowHierarchyValue1;
if (colHierarchyValue0 !== “(All)”)
queryString += “&$” + colHierarchyName0 + “=” colHierarchyValue0;
if (colHierarchyValue1 !== “(All)”)
queryString += “&$” + colHierarchyName1 + “=” colHierarchyValue1;
//
// Navigate
//
navigation.actionTarget = dundas.view.ActionTarget.NEW_WINDOW;
navigation.actionType = dundas.view.ActionType.NAVIGATE;
navigation.navigateType = dundas.view.DataActionNavigateType.URL;
navigation.targetUrl = “(URL of data table dashboard)” + queryString;
navigation.execute(new dundas.view.ActionEventArgs());