i recently implemented a way for activating/deactivating bex conditions in design studio via context menu.

For realizing this, following steps are neccessary:

1) Create a popup “PU_CONDITIONS” in your design Studio application.

2) Create a checkboxgroup “CBG_CONDITIONS” and a button “BT_CLOSE” in PU_CONDITIONS.

3) Create a technical component “context menu” in your design studio application.

4) Within “context menu” insert a menu entry “i.e. conditions”.

5) Edit the script for the custom menu entry: – Insert the following script:

var  condition = DS_1.getMeasureFilters();

var str=””;

condition.forEach(function(element, index) {

//foreach condition which is implemented in DS_1 the name is added to CBG_CONDITIONS

     CBG_CONDITIONS.addItem(element, DS_1.getMeasureFilterName(element));

//if the condition is active, it will be added to variable “str” and separated by ‘,’

     if (DS_1.isMeasureFilterActive(element)) {  




//the items in CBG_CONDITIONS which are found in variable “str” are set as selected


//PU_CONDITIONS is shown


With the script shown above, every condition which is defined in DS_1 underlying bex-query will be loaded and written down into CBG_CONDITIONS. By default every active bex-condition is selected in chexboxgroup “CBG_CONDITIONS”.

6) Insert the following script to the on click Event of BT_CLOSE:


var  condition = DS_1.getMeasureFilters();

var selCond = CBG_CONDITIONS.getSelectedValues();

//remove all activated conditions

condition.forEach(function(element, index) {

     DS_1.setMeasureFilterActive(element, false);


//loop on all selected conditions

selCond.forEach(function(el_chboxes, index) {

//loop on all conditions of DS_1

     condition.forEach(function(el_datasource, index) {

//foreach via checkbox selected condition the corresponding condition of DS_1 will be activated

          if(el_datasource == el_chboxes){

               DS_1.setMeasureFilterActive(el_datasource, true);




With the script shown above all conditions of DS_1 will be deacitivated in the first step. After this, every condition of DS_1 which is selected per checkbox will be activated.

I hope the shown approach maybe useful.

Kind regards,


To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply