Blogs / SAP / SAP BusinessObjects / SAP Design Studio / Tips and Tricks / Dynamic selection in Listbox – using Arrays in SAP Design Studio 1.3

Dynamic selection in Listbox – using Arrays in SAP Design Studio 1.3

Sep 8, 2014


More often than not, we get dashboard and report requirements having two or more cascading filters wherein the list of values of one dimension depends on the value chosen in the other. Recently, I came across one requirement – to have a two-level cascading filter with City and Customer and to have the first 10 Customers of the chosen city, selected by default – and hence plotted on a 10-series-chart.

Shown below are the two multi-select listboxes.

SAP Design Studio – Dynamic Selection in Multi-Select List Box Using Arrays

In SAP Design Studio, since there is no direct method to retain the first 10 Customers as default selection for a dynamically changing list, I had to think of a workaround – The Arrays feature in DS 1.3 was the perfect solution !

The list of cities in the first listbox is static and the customer list in the second (LISTBOX_2) is dynamic – the customer list is filtered by the city selection made in the first. This is the code segment I used, to select the first 10 customers by default.

/*Load the first 10 customers in an array variable*/

var arr=DS_1.getMembers(“ZR_CUSTOMER”, 10);

/*Define a string variable*/

var str=””;

/* Use a forEach loop on the array variable to concatenate the 10 customers, in str*/

  1. arr.forEach(function(element, index)

/*Use split function to split the string into individual values */


The forEach function, requiring two parameters, element and index, simply iterates through all the elements in the array.

Note that if you want only the first 3 customers in the array, then use 3 instead of 10.

var arr=DS_1.getMembers(“ZR_CUSTOMER”, 3);

An empty string variable str is used to append the first 10 customers using comma as the delimiter. For every iteration of the forEach loop, the str variable is appended with the internal key of the customer.

At the end of 10th iteration the str variable will be


Then the string is split into individual elements using str.splitfunction and is used tosetSelected Values for LISTBOX_2.

Arrays are still primitive in SAP Design Studio 1.3, but they can be capitalized really well through workarounds. This is just one example of how they can be used to easily achieve an often asked functionality.

Read more blogs from SAP BusinessObjects Design Studio category here.

Corporate HQ:
5920 Windhaven Pkwy, Plano, TX 75093

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

Copyright © Visual BI Solutions Inc.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This!

Share this with your friends and colleagues!