Skip to Content

In this short post I would like to share a drill-down script for Lumira Designer (formerly known as Design Studio). It’s not rocket-science, but hopefully would save some time for you.

The demo is on the well known clothing company eFashion. Operating in the US and doing especially well in Texas!

The original code came from Axel Blaze, posted here. But unfortunately he shared the code only as screenshots and had some minor issues as well. It was a bit cumbersome.

So here’s the updated code as text to easly copy and paste.

These are the main components of the solution:

  1. Global Variables
    1. DimensionsOfAggregationLevels – This is a string array to store the dimension keys of the aggregation levels in order.
    2. Level – This will store the actual drill level, starting from 0.
  2. GLOBAL_SCRIPTS
    1. getSelectionData
    2. ClearDataSourceFilter
  3. Chart “On Select script”

Please find the scripts below and a link to an example at the buttom.

DimensionsOfAggregationLevels

DimensionsOfAggregationLevels = ["OBJ_218", "OBJ_166", "OBJ_376"];
  • On the Properties view you need to change the Array property to true
  • You need to set the initial values at the APPLICATION \ On Variable Initialization script
  • To get the OBJ_218 and like, you may use a trick: on the charts “On Select” event \ type in DS_1.getDimensionText(dimension) and while “dimension” is still highlighted hit Ctrl+Space. “Content assistance” will list all of the dimensions available on the dataset with the object keys. This could be handy if the key is a longer asjdjsndfkbweasd

getSelectionData

Input parameters:

Name / Type / Array

  • DS / DataSourceAlias / false
  • Chart / VizFram / false
  • PrimaryDimension / String / false
  • FilterDimension / String / false
  • FilterValue / String / false

Script:

var STR = "";
 DS.moveDimensionToRows(PrimaryDimension, 0);
 DS.setFilter(FilterDimension, FilterValue);
 DS.removeDimension(FilterDimension);
 Chart.clearSelection();
 Chart.setDataSource(DS);
 var MEM = DS.getMembers(PrimaryDimension, 100);
 MEM.forEach(function(element, index) {
 STR = STR + '"' + element.text + '"';
 });
 STR = "{" + '"' + PrimaryDimension + '":' + "[ " + STR + " ]" + "}";
 return STR;

ClearDataSourceFilter

Input parameters:

Name / Type / Array

  • DS / DataSourceAlias / false
  • Chart / VizFram / false
  • FilterDimension / String / true

Script:

//APPLICATION.alert("No more drill down. Going back to initial level."); // Optional alert
 Chart.clearSelection();
 FilterDimension.forEach(function(element, index) {
 DS.clearFilter(element);
 DS.removeDimension(element);
 });
 DS.moveDimensionToRows(FilterDimension[0], 0);
 Chart.setDataSource(DS);
 Level = 0;

Chart On Select

Script:

if (Level < 2){
var selected = CHART_1.getSelectedMember(DimensionsOfAggregationLevels[Level]).internalKey;
CHART_1.setDataSelection(GLOBAL_SCRIPTS_1.getSelectionData(DS_1, CHART_1,  DimensionsOfAggregationLevels[Level+1],DimensionsOfAggregationLevels[Level], CHART_1.getSelectedMember(DimensionsOfAggregationLevels[Level]).internalKey));
Level = Level+1;
}
else
{
GLOBAL_SCRIPTS_1.ClearDataSourceFilter(DS_1, CHART_1, DimensionsOfAggregationLevels);
}

 

Example: Lumira Designer Drill Down Demo.lumx

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply