Skip to Content

How To Pass a Filter to Data Selection in Chart & 2nd Data Source (with modification on the way)


you have two data sources and a chart, you want to pass the filter to those and modify on the way..


the problem starts with conversion from external to internal key, this must be solved by yourself (unfortunatelly)

Working Example


Simple Code as an Idea

// get the filter with external key
var externalFilter = DS_1.getFilterExt("0BC_PERS1");
// place an error message for debug
APPLICATION.createErrorMessage("Filter External: " + externalFilter);
// split the external filter
var splittedString = externalFilter.split(";");
// create as many variables as many you need in the array
var first = "";
var second = "";
// this array is requried for the "primitive" transformation between internal and external key
var anArrayOf5ForLoop = [0,1,2,3,4];
// loop on the splitted external keys
splittedString.forEach(function(filterELem, index) {
  // clean up any spaces
  filterELem = Convert.replaceAll(filterELem, " ", "");
  // very basic conversion from external key to internal key, add 0 (works only for me!)
  anArrayOf5ForLoop.forEach(function(loopElem, index) {
   if(filterELem.length < 5) {
    filterELem = "0" + filterELem;
// set the variables based on index
  if (index == 0) {
  first = filterELem;
  if (index == 1) {
  second = filterELem;
// create an array with all variables, seems empty values are not breaking selection
var thirdAsEmpty = "";
var selectionsAsArray = [first, second, thirdAsEmpty];
// just for debug
var selectionArrayAsString = "";
selectionsAsArray.forEach(function(selArrayInternalElem, index) {
  selectionArrayAsString = selectionArrayAsString + " | " + selArrayInternalElem;
APPLICATION.createErrorMessage("Filter Internal: " + selectionArrayAsString);
// hmm, works only for me as I can convert
  "0BC_PERS1": selectionsAsArray
DS_2.setFilterExt("0BC_PERS1", externalFilter);

Tricky Points

there are some tricky points in the script above.

1) by getFilterExt() you get “external” key, and selection on chart requires “internal” key. you have to conver, this can be done somehow in code – but most probably hard coded…

2) you need to pass an real ARRAY to setDataSelection – and this is a problem, as today you cannot create an array of “dynamic” size, but you can try to create an array of eg. 20 and leave the rest empty, seems this will work.

Source Code

A test source code can be taken from:

DesignStudioBiAppRepository/content.biapp at master · KarolKalisz/DesignStudioBiAppRepository · GitHub

make a try!

You must be Logged on to comment or reply to a post.
  • This is very useful and nice. But I still somehow feel API should be given by SAP for these things. Really appreciate your workaround for passing Arrays and re-formatting the read Dimension filter variable at runtime and passing it to the chart as a datasource.

    I implemented the same logic and it seems to work but I really miss very simple String and Array functions like concatenate, find and replace etc…

    This tools needs all those to be the best bet and developers choice


    • I understand your point – only what I can do on delivered software is to show any “option” if possible to help you short term.

      Long term, this looks like a break in the api – at least 2 points need to be addressed:

      * something like getFilterInt() and

      * getFilterInt as array in order to pass it into daa selection.

      I will ask my colleagues if we can consider such extension in next releases, but this is one of many requirements.

      Could you please place also a point in SAP BusinessObjects Design Studio: Home?

      regards, Karol

      • Hi Karol,

        Thanks for taking the feedback forward. I like the way SAP gathers feedback from developers. I updated in the Ideas place.

        One more question if you have sometime. I also use Lumira, using that is much more easy and intuitive whereas my first take on this is a bit complicated.

        For e.g.

        • Creating an extra measure or a calculated Key fig.
        • Using Cubes and BW tables directly as datasources etc.

        Any reason why and how SAP wants to take these forward.



        • Hi Krishna,

          Creating an extra measure or a calculated Key fig.

          This is in plan for future releases of design studio, but not available now. It is a typical BEx Web feature.

          Using Cubes and BW tables directly as datasources etc.

          This is posible using the DSL connectivity option in Design Studio 1.3 release (via Universes)

          Regards, Karol

          • Hello Karol,

            I want to pass a Hierarchy node in the time dimension into the chart.

            I am trying with the following.

            else if (STR == “+1415.Q1(/CPMB/NDD9Q3V)”)   //<runtime value of Hierarchy node selected>


            // trying to pass to chart the whole hierarchy.. ( I have a workaround hard coding what is there in the hierarchy but still..

            CHART_14.setDataSelection( {“/CPMB/NDD9Q3V”: [“HIERARCHY_NODE/\\/CPMB\\/NDD9Q3V/1415.Q1”] } );


            It says it does not recognize at runtime when I execute this…Any tips please.



          • Hi Krishna,

            the examples above are restrricted to members. and will not work on hierarchies.

            With hierarchies this is more complex, as in filter you get only the “external key” and data selection requires “internal key”. perhaps you can try to make your own mapping (eg. with the COLLECTION component which is in the SDK pack) , but also for that, you would need to figure out the mapping (in ABAP on hierarchy edit UIs?