Skip to Content
Author's profile photo Christian Schäfer

Design Studio 1.3 Joining Arrays of multiple Datasources + Looping Arrays + Filter Datasource by Member

In this example i’m giving you a quick overview of how joining arrays and looping through them could be done. This is demonstrated by an onselect Event of a Dropdown component which is dynamically filled in the onstartup Event.

First Go to Tools > Preferences open the Scripting Section on the left side of the screen and click on Templates. Now import the attached template file if it isn’t integrated by default.

Now select the onstartup Event of your pagebook and fill in the script code below. Replace “DIMENSION” with the Dimension (technical name) you want to be filled in the Dropdown component. The script joins two arrays of different datasources and checks whether an element is already in the list or not.

var check = 0;
var kpis_ds1 = DS_1.getMembers("DIMENSION", 10);
kpis_ds1.forEach(function(kpi1, index) {
DROPDOWN_2.addItem(kpi1.internalKey, kpi1.text);
var kpis_ds2 = DS_2.getMembers("DIMENSION", 10);
kpis_ds2.forEach(function(kpi2, index) {
       kpis_ds1.forEach(function(kpi1, index) {
             DROPDOWN_2.addItem(kpi2.internalKey, kpi2.text);

After this is done select the Dropdown Box, edit the onselect Event and fill in the following script.

var x = DS_1.getMembers("DIMENSION", 10);             //DS_1 Datasource

x.forEach(function(element, index) {
  if(element.text == DROPDOWN_2.getSelectedValue()){ 
       DS_1.setFilter("DIMENSION", element);

That’s it. You now have a dynamically filled Dropdown component which is filtering the choosen dimension of your datasource.

Have fun coding!

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.