In the previous blog of this series, we learned about the dynamic display of measures and dimensions in widgets. In this blog, we will learn how to invoke the explorer functionality in an analytic application, in SAP Analytics Cloud.

 

The Explorer

The Explorer helps you perform ad-hoc exploration and gain insights into your data. It is possible to invoke the explorer on-demand in analytic applications, with the exploration limited to pre-designated measures and dimensions.

View the data explorer in action here.:

sap-analytics-cloud-application-design-Series-11-enable-explorer-using-analytic-functions

 

1. Identify where to provide the functionality

Let us start with the chart below. We will add a button ‘Launch Explorer’ which will be used to invoke the explorer feature during run-time. Note that you also have the option to provide this feature at the application level – instead of at the chart level.

sap-analytics-cloud-application-design-Series-11-enable-explorer-using-analytic-functions

 

2. Add the Script

Launching the explorer is simple. Add the script API getDataExplorer() to the onSelect event of the button.

sap-analytics-cloud-application-design-Series-11-enable-explorer-using-analytic-functions

 

Save and run the Analytic Application. Select the button ‘Launch Explorer’ to launch data explorer. By default, the script opens the explorer with the same dimensions and measures, as available in the chart.

sap-analytics-cloud-application-design-Series-11-enable-explorer-using-analytic-functions

 

3. Add Additional Dimensions & Measures

If you would like the user to be able to view additional dimensions and measures in the default Explorer view, you can use the setAdditionalDimensions() and setAdditionalMeasures() script APIs. The following code samples add the dimension “Vendor” and the measure “Bottle Cost”:

Chart_Category.getDataSource().getDataExplorer().setAdditionalDimensions([“VENDORNUMBER”]);

Chart_Category.getDataSource().getDataExplorer().setAdditionalMeasures([“STATEBOTTLECOST”]);

Chart_Category.getDataSource().getDataExplorer().open();

sap-analytics-cloud-application-design-Series-11-enable-explorer-using-analytic-functions

 

At runtime, the explorer shows the additional dimension and measure that were just added.

sap-analytics-cloud-application-design-Series-11-enable-explorer-using-analytic-functions

 

4. Add all Dimensions and Measures

If you would like all dimensions instead, use the getDimensions() function. To add all measures, there is no direct function available currently. However you can accomplish this by using getMembers() and then create a string array of measure id’s.

var measures_1 = Chart_Category.getDataSource().getMembers(“Account”);

var measures_2 = ArrayUtils.create(Type.string);

for(var i = 0; i<measures_1.length; i++){

                measures_2.push(measures_1[i].id);

}

Chart_Category.getDataSource().getDataExplorer().setAdditionalDimensions(Chart_Category.getDataSource().getDimensions());

Chart_Category.getDataSource().getDataExplorer().setAdditionalMeasures(measures_2);

Chart_Category.getDataSource().getDataExplorer().open();

sap-analytics-cloud-application-design-Series-11-enable-explorer-using-analytic-functions

sap-analytics-cloud-application-design-Series-11-enable-explorer-using-analytic-functions

This will open the explorer with all the measures & dimensions during runtime.

* * *

In the subsequent blog, we will learn how to launch Smart Discovery from analytic applications.

Reach out to us here today if you are interested in evaluating if SAP Analytics Cloud is the right tool for you.

Subscribe to our Newsletter

5600 Tennyson Pkwy
Suite 120
Plano TX 75024.

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com