✆+971 58 5616 616  ✉  info@insightcubes.com

InsightCubes Logo

Using the getHierarchies() and setHierarchy() APIs with SAP Analytics Designer

How to use the getHierarchies() and setHierarchy() APIs with SAP Analytics Designer

In this blog post we will give a comprehensive example on using the getHierarchies() and setHierarchy() APIs with SAP Analytics Designer.
The getHierarchies() is used to return the description and ID of all hierarchies of the dimension. While the setHierarchy() is used to set the hierarchy on the dimension.

In this example we will be using the cascading filter process; as in filtering on dimensions and then filtering according to hierarchies to choose how to display the data.

We will add two Dropdown Lists, one for filtering Dimension and the other for filtering Hierarchies and depending on what Dimension we choose to filter on, the Dropdown List for the Hierarchies filters will change.

There is always one consistent filter for Hierarchies which is Flat Presentation and according to our chosen Dimension, we might either only have that one or have more options.

For example, if we are filtering on Account, we have two choices for Hierarchies; Flat Presentation and hierarchical. When selecting Flat Presentation the selected member will be listed without its descendants, if any. As for hierarchical, if the member is a parent, the descendants will be listed.

The different filters can be chosen by simply selecting them from the Dropdown lists we added.

First add a table widget to your analytics application. From the builder panel add the account dimension to the Rows, and the Version dimension to the Columns. Filter the account and version dimensions to balance sheet, and actual respectively. Note this analytics application example is using a planning enabled model. Hence, the table widget is planning enabled.

Table details

Now add two drop downs, the first for the dimensions, and the second for the hierarchy.

Dropdowns

Create a Script Variable, call it currentDimension, Type string, and the Default Value Entity.

Fill the Dimension dropdown through the builder as follows:

And add the following code to the Dimension dropdown’s onSelect fx

Add the following code to the Hierarchy dropdown’s onSelect fx:

Then add all the on Initialize code

Recent Posts

Get in Touch

Learn more and ask us About Our Cloud Consolidation Solution

Share This Post

Share this Blog!

Share this with your network.

Want to Know More?

Get In Touch

Feel free to contact us, and we will be more than happy to answer all of your questions.