✆ UAE: +971 58 5616 616, ✆ USA:+14099168409,   ✉ info@insightcubes.com

Using the removeDimensionFilter() and setDimensionFilter() API’s with SAP Analytics Designer

How to use the removeDimensionFilter() and setDimensionFilter() API’s with SAP Analytics Designer

The removeDimensionFilter() and setDimensionFilter() API’s are used to filter either on members or properties of a dimension on tables and charts with SAP Analytics Cloud Analytics applications.

In this blog we used an example that sets filters from dropdowns and checkbox groups on 6 tables and 26 charts using one loop and only refreshing the widget when visible, hence, making it a best practice example, keeping the analytics application fast and responsive despite loading massive amounts of data.

OnInitialization

After setting up the dropdowns and checkbox groups and writing all the fx code onInitialization for the dimensions in dropdowns needed in the report;

Example:

Populating Currency Dropdown with currency dimension members, Checkbox groups will be manually filled and have no code onInit

Create all the tables and charts

Create and detail all the tables and charts needed in your reporting dashboard, then make sure to chose the Refresh active Widgets Only from the Data Refresh on the tables and charts Builder on each.

Refresh active widgets only

Script Variables

Create all the Script Variables for the aforementioned filtering widgets (dropdowns and checkbox groups) as shown below:

Script Variables, Type string, and set as an Array for all filter widgets

In our analytics application we used 3 dropdowns and 3 checkbox groups to filter tables and charts from 6 different dimensions; Entity, Currency, Intercompany using dropdowns; Category (version), Audit Trail, and flow using checkbox groups.

Create a Script Variable for each dimension; since they are reusable elements that store a value of a certain type. Set them all to Type string, and activate the Set As an Array toggle button.

Script Objects

Then create a Script Objects; call it Utils, and add a Script Function; call it updateWidgets, with a Return Type void, then add an Argument call it source, and set its Type to string as shown below.

updateWidgets Script Function

Using the removeDimensionFilter() and setDimensionFilter() API’s to apply filters on widgets sometimes will have special requirements.

The Analytics Application we used in this blog has a special filtering requirement, for example, we have one flow checkbox group filtering only on Balance sheet tabs as a property of a dimension. And the Intercompany dropdown filter only on intercompany related tabs.

We will share in another blog how to hide and show filters depending on tab selections; which will take your filtering capabilities to a higher level.

Script Function fx

On the Script Function fx we created a table list and a chart list that need to be updated in arrays. The arrays for tables and charts need to be separate, since SAC can’t have arrays of mixed widget types. These 2 arrays are used at the end of the script to update widgets once with appropriate actions.

Table and chart lists as array

After creating the tables and charts arrays, we use the removeDimensionsFilter and setDimensionsFilter APIs. The for statement will loop through all tables and charts once, and the if statement will update filters appropriately.

Table list loop and apply filters once on any filter change
Chart list loop and apply filters once on any filter change

Now the user is able to remove and set dimension filters from widgets on multiple tables and charts.

Recent Posts

Audit Trail Configuration Toolkit

Audit Trail Configuration Toolkit Audit Trail Configuration Toolkit provides a comprehensive set of tools and resources to help developers easily configure the behavior of the

Scope Configuration Toolkit

Scope Configuration Toolkit With our Scope Configuration Toolkit, you can take control of your consolidation scopes with confidence and precision. This interface makes it extremely

SAP Analytics Cloud Calendar

SAP Analytics Cloud Calendar Features and API’s Workflow Organization (Calendar) Use the SAP Analytics Cloud calendar to organize your workflows with calendar events: You can

SAP Analytics Cloud Data Connections

Live connection (Online) and Import connection (batch) with SAP Analytics Cloud SAP Analytics Cloud enables access to on-premise and cloud data sources using two main

Get in Touch

Learn more and ask us About Our Cloud Consolidation Solution

Share This Post

Share this Page!

Share this with your network.

Want to Know More?

Get In Touch

Something isn’t Clear?


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