Skip to Content
Jun 22, 2021 at 10:21 AM

Setting Dimension display mode and flattening hierarchies on the fly - Live BW conn


I have a table that we want users to be able to add/remove dimensions & measures as they like;
this is easily accomplished via the native navigation panel menu - we give them a button to open it:

Button code:

At runtime the table contains say, 3 dimensions - all formatted to show only the description with a flat hierarchy.
If they user then edits the table and adds a different dimension it will default to ID & Description display mode.
My code below works - it loops through all the dims and sets the display mode as we'd like.

However we need this code to run during the 'onResultChanged' event for the table - this makes it dynamic/run on the fly when users change things.
The issue is that it continually loops forever as it keeps triggering an onResultChanged event....
I'm aware of the 'break;' parameter and the setrefreshPaused(true); -- but not sure where in the code we can place them to stop the looping *note we're using Live BW connections*

Code: to loop through dimensions in the table and set any hierarchies to flat + show the Dimension description

var dimensions = Table_1.getDataSource().getDimensions();
for (var i=0;i<dimensions.length;i++)
{ Table_1.getDataSource().setHierarchy(dimensions[i],'__FLAT__'); Table_1.getDataSource().setMemberDisplayMode(dimensions[i],MemberDisplayMode.Description); }