Hello,
I’m trying to change the date hierarchy level (Year/Month/Day) for a chart in a change event script. I’ve read through the “Modify a filter / view parameter using scripting” docs and tried copying examples and not having much luck.
I have a poDate view param, dateChart bar chart, and date range filter control. I added a button to change the level to test this. The script does some other things as well, so have confirmed the rest works fine (showing/hiding series on the chart). The script:
// tested with 0/1/2 for Year/Month/Day
var newLevel = 1;
var viewParameter = this.parentView.control.getViewParameterByName("poDate");
// these are both undefined at first, maybe that's normal?
console.log("Old: " + viewParameter.parameterValue.detailsLevelDepth + ", " + viewParameter.parameterValue.topLevelDepth);
viewParameter.parameterValue.detailsLevelDepth = newLevel;
// Set the top level depth to show details level depth.
viewParameter.parameterValue.topLevelDepth = -1;
// Sets the value of lastModifiedTime to now
viewParameter.invalidateParameterValueLastModifiedTime();
// Update all the connected adapters with the newly modified values
// Includes data visualizations and filter controls
viewParameter.refreshAllAdapters();
I see the chart refresh, but it never changes the level. I can change level manually by right clicking and “change level” just fine. Using the latest Dundas 8 update for Ubuntu.
Thanks for any insight,
Kevin