Collect different views of an SAC Application

An important and absolutely powerful feature of biExport is the automatic collection of different views.

With this feature you can collect data:

  • from different SAC applications and stories
  • from different pages or tabs of an SAC application
  • from different filter contexts of an SAC application
You can also mix data from SAC Applications and SAC Stories in one export document!

In this post we focus on SAC Analytical Applications. For SAC Stories, generic URL parameters can be used to pass variable values, filters and the selected page.

Also, we focus on triggering the Briefing Book export from the biExport Widget via scripting. As an alternative, the generation can also be triggered from the biExport scheduler.

The application to be exported

Briefing Book generation is activated by adding at least one Export Application. This means that instead of using the current view of the SAC Application, the biExport service will now re-execute the applications specified in the script.

biExport_1.addExportApplication("31621AF066DCC7F2DC3B1A8601759B2C"); biExport_1.addExportApplication("BC21AF066DCC7F2DC3B1A8601759B37");

This results in two applications "31621AF066DCC7F2DC3B1A8601759B2C" and "ABC21AF066DCC7F2DC3B1A8601759B37" being executed as a source for the export.

The method clearExportApplications() can be used to reset the applications that shall be exported.

When the biExport service executes the SAC Application, it executes the URL as an end-user would do. So it will export the initial view of the application. If you want to export a certain view or filter state, you have to use the SAC application’s URL parameters.

The URL parameters to be passed

biExport offers a generic framework for passing URL parameters. You have to make sure yourself that the parameters, which you pass, are interpreted by SAC.

You can use these URL parameters in different ways:

  1. Pass a fix filter to the dashboard, e.g. the year: biExport_1.addURLParameter("YEAR", ["2022 "], false, []);
  2. Execute different views, e.g. four different locations: biExport_1.addURLParameter("LOCATION", ["NORTH", "SOUTH", "EAST", "WEST"], true, [] );
    If you pass multiple values that shall filter the SAC application individually, set "iterative" (the third parameter) to true. As a result, biExport service creates a separate URL and a separate execution for each value.
  3. Execute different tabs or pages of the application: biExport_1.addURLParameter("TABNO", ["1", "2", "3"], true, ["31621AF066DCC7F2DC3B1A8601759B2C"] );
    If you define multiple applications to be executed, you can set URL parameters specifically for an application via applicationIds (the fourth parameter).
If you pass more than one parameter with "iterative" set to "true", biExport creates a cartesian product of the iterations. In our case, it would execute three tabs for four locations, resulting in 12 separate URLs.

Creating URL parameters for an SAC application

First of all, you need to define a Script Variable (aka URL Parameter):

/mimes/SAC_Screenshots/BriefingBook_06.PNG

SAP only supports those parameters to be passed to an Analytic Application that have been explicitly created in this way.

In a second step you have to make sure that the SAC Application processes the parameter. For this, we implement the onInitialization event:

/mimes/SAC_Screenshots/BriefingBook_07.PNG
We simply pass the "LOCATION" parameter to the filters of the location dimension. The script would look similar for the "TABNO" parameter - in that case we would set the selected tab of the tab strip.

It is wise to check the script by manually adding the new parameter to the URL: appId=31621AF066DCC7F2DC3B1A8601759B2C;p_LOCATION=SA1. Make sure to add "p_" to the URL parameter in that case. If the filter is taken, also biExport will be able to pass it.

Export Template

Export Templates can be used to define the export document. If multiple dashboard views are collected for the Briefing Book, you can use conditions to control where a specific view shall appear in the document.

If a Widget ID is already unique, you do not have to specify additional conditions. However, it might be interesting to add them anyhow, so it is clearly documented from which application and page it is taken.

In our example, the "LOCATION" parameter retrieves multiple versions of the same Widget, e.g. "Chart_1". Hence, "LOCATION" should be added to the condition:

%Chart_1%{LOCATION=NORTH} %Chart_1%{LOCATION=SOUTH}

However, "Chart_1" might exist in both SAC applications "31621AF066DCC7F2DC3B1A8601759B2C" and "ABC21AF066DCC7F2DC3B1A8601759B37". In that case also "APPLICATION" must be added to the condition. In this second example, we also add TABNO, eventhough it is not technically needed:

%Chart_1%{LOCATION=NORTH;APPLICATION=31621AF066DCC7F2DC3B1A8601759B2C;TABNO=2} %Chart_1%{LOCATION=NORTH;APPLICATION=ABC21AF066DCC7F2DC3B1A8601759B37;TABNO=2}

Special Settings

By default, biExport reuses the browser size of the end-user for the execution of the applications. If you want to create exports independently of the screen resolution of the end-user, you can fix the resolution for the service-side execution:

biExport_1.setStaticHeight(1600); biExport_1.setStaticWidth(1200);
Thilo Knötzele
Author: Thilo Knötzele
Creation date: 22.11.2022
Category: Implementation
back to overview