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
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.
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:
-
Pass a fix filter to the dashboard, e.g. the year:
biExport_1.addURLParameter("YEAR", ["2022 "], false, []);
-
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. -
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).
Creating URL parameters for an SAC application
First of all, you need to define a Script Variable (aka URL Parameter):
In a second step you have to make sure that the SAC Application processes the parameter. For this, we implement the onInitialization event:
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.
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.
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);