How to export a COMPLETE Lumira Designer / Design Studio DASHBOARD for multiple filter selections

In my blog posts

and

I demonstrated how you can export all contents of your reporting application. In the first example the user was able to export the contents of all tabs with just one click, the second example gave the opportunity to choose which tabs to export.

Today we will enhance the example even more:

We will add a dropdown box for profit centers, which enables the user to switch the online view between OVERVIEW and any of the TOP 10 profit centers.

For the export, we not only want the user to be able to choose the tabs. Even more, the user shall not have to switch profit centers to export their data one by one. Instead, each of the profit centers in the dropdown box shall be shown automatically in a different view of the export document.

Example Implementation: Standard Functions

So here is how we make this happen:

First of all, we add the dropdown box:
http://www.biexcellence.com:80/mimes/designstudio_export/LumiraDesigner/LumiraDesigner_21.PNG

And we have to assign it to the 0PROFIT_CTR dimension of SAP BW:

http://www.biexcellence.com:80/mimes/designstudio_export/LumiraDesigner/LumiraDesigner_22.PNG

So much for the standard functions.

Example Implementation: Export Iteration

Now let’s see how we can enable the export to iterate over the dimension:

1. First, we have to add a new URL parameter that can receive the Profit Center. Remember that the Export service will generate the different views of the application by creating separate URLs with different URL parameters. We did the same before to be able to pass the tab to be exported:
http://www.biexcellence.com:80/mimes/designstudio_export/LumiraDesigner/LumiraDesigner_23.PNG

2. Then we also have to process the URL parameter by enhancing our onStartup script:
// EXPORT: select tab index
TABSTRIP_1.setSelectedTabIndex(XTABNO);

// EXPORT: select profit center
if (XPROFITCTR != "") {
 DS_1.setFilterExt("0PROFIT_CTR", XPROFITCTR);
 DS_2.setFilterExt("0PROFIT_CTR", XPROFITCTR);
 DS_3.setFilterExt("0PROFIT_CTR", XPROFITCTR);
}

3. Most importantly, we have to enhance the script that sets the URL Parameter Array parameter of the biExport component:

The script so far read out the selected values of the check boxes in the Export Content popup:

var lvalues = "";

CHECKBOXGROUP_1.getSelectedValues().forEach(function(element, index) {
  lvalues = lvalues + element + ";";
});

var lparam = OPENBIEXPORT_1.createUrlParameter2("","", "XTABNO", true, lvalues);
var lparams = [lparam];

OPENBIEXPORT_1.setUrlParameterArray(lparams);

Now we enhance this script by iterating over all values of the dropdown box. For each profit center, we want to execute the existing iteration over all tabs selected in the checkbox group. We call this a “Dependent Iteration” – a concept that makes you easily pass different filters and iterations to individual primary iterations!

Let’s build up the script!

1. First of all, we have to change above script a little bit, as the tab iteration is now a “Dependent URL Parameter” – we have to use a different “create” method of the biExport component:

var lvalues = "";

CHECKBOXGROUP_1.getSelectedValues().forEach(function(element, index) {
  lvalues = lvalues + element + ";";
});

var lparam = OPENBIEXPORT_1.createUrlDependentParameter("XTABNO", true, lvalues);

var lparams = [lparam];

2. The first iteration shall contain an overview of all profit centers. That is why we create one URL Parameter value with an empty Profit Center Key:

var lprofitctr_values = [OPENBIEXPORT_1.createUrlDependentValueComplex(“”, lparams)];

3. Now we want to read out the profit centers. As Design Studio / Lumira Designer does not offer a script function to access the items of the dropdown box, we read the values directly from the datasource instead:

DS_1.getMembers("0PROFIT_CTR", 10);

4. For each of the values, we create a separate Url Parameter value:

DS_1.getMembers("0PROFIT_CTR", 10).forEach(function(element, index) {
    var lvalue_profitctr = OPENBIEXPORT_1.createUrlDependentValueComplex(element.internalKey, lparams);
  lvalues_profitctr.push(lvalue_profitctr);
});

5. In the last step, we have to add all Parameter values to the Url Parameter XPROFITCTR and pass it to the biExport component:

var param_profitctr = OPENBIEXPORT_1.createUrlParameter2Complex("", "", "XPROFITCTR", true, lvalues_profitctr);

var params_all = [param_profitctr];

OPENBIEXPORT_1.setUrlParameterArray(params_all);

 

Well that’s it!

Of course you can also create more complex examples. For more information and examples, please check section 5.5.3 of our biExport documentation.

Appendix - The entire export script

var lvalues = "";

CHECKBOXGROUP_1.getSelectedValues().forEach(function(element, index) {
  lvalues = lvalues + element + ";";
});

var lparam = OPENBIEXPORT_1.createUrlDependentParameter("XTABNO", true, lvalues);

var lparams = [lparam];

// create profit center param for overview page
var lprofitctr_values = [OPENBIEXPORT_1.createUrlDependentValueComplex(“”, lparams)];

DS_1.getMembers("0PROFIT_CTR", 10).forEach(function(element, index) {
    // Create URL param value object for each profit center, with Dependent Parameter of tab
    var lvalue_profitctr = OPENBIEXPORT_1.createUrlDependentValueComplex(element.internalKey, lparams);
  lvalues_profitctr.push(lvalue_profitctr);
});

// Set Profit Center Url Parameter with value object array
var param_profitctr = OPENBIEXPORT_1.createUrlParameter2Complex("", "", "XPROFITCTR", true, lvalues_profitctr);

// Create URL Parameter Array
var params_all = [param_profitctr];

// set all URL parameters on export component
OPENBIEXPORT_1.setUrlParameterArray(params_all);

 

Thilo Knötzele
Author: Thilo Knötzele
Creation date: 23.01.2018
Category:
back to overview