cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Flat Hierarchy with a switch when 'Show only leaves' is activated

DavidRuizC
Discoverer
0 Kudos
127

Hi all,

I'm working in SAP Analytics cloud and I'm trying to create a switch that changes all the row dimensions' hierarchies to FlatHierarchy. The issue I'm facing is that if one (or more) of these dimensions has already the 'Show only leaves' option activated, my script does not work.

DavidRuizC_0-1718720452655.png

This is my script:

if (Switch_1.isOn()){
Table_1.getDataSource().setHierarchy("Dimension1",Alias.FlatHierarchy);
Table_1.getDataSource().setHierarchy("Dimension2",Alias.FlatHierarchy);
Table_1.getDataSource().setHierarchy("Dimension3",Alias.FlatHierarchy);
Table_1.getDataSource().setHierarchy("Dimension4",Alias.FlatHierarchy);
}

If all dimensions are in the 'All' hierarchy, when I click on the switch it works, but if I have already selected 'Show only leaves' in any of the dimensions it does not work and throws this message "hierarchyId is undefined when process member navigation filter:(...)" ¿Is there any way of doing this?

View Entire Topic
N1kh1l
Active Contributor
0 Kudos

@DavidRuizC 

Not sure but may be first try to set the hierarchy to All and then set it to flat.

 

Nikhil

DavidRuizC
Discoverer
0 Kudos

Hi Nikhil,

I already tried that and does not work. But thanks for your comment!