Skip to Content

When there is a need to implement conditions or set filters on key figures in SAP BusinessObjects Design Studio dashboards, it becomes a challenge to achieve this directly in the application. To implement this functionality in our SAP BusinessObjects Design Studio dashboards, we require the help of SAP Business Explorer (BEx). Setting filters on Key Figures can be achieved by defining Conditions in SAP Business Explorer (BEx).

This blog post gives an insight into manipulation of SAP Business Explorer (BEx) conditions in SAP BusinessObjects Design studio.

Two types of conditions in SAP Business Explorer (BEx) are:-

          i) Conditions with variables

         ii) Conditions with constant values

Conditions with variable

In this case, the condition works on the input value of the variable.

To toggle the state of a condition, we can pass null value to its variable. When null value is passed, the condition is temporarily inactive. So we can pass the values for the required condition variable and pass null value to rest of the variables.

//To set the value of the condition variable in BEx with null
APPLICATION.setVariableValueExt(variablename,” ”);

Conditions without variable

In this case, we cannot pass a value to the condition in runtime i.e. from SAP BusinessObjects Design Studio.

So if we have more than one condition, we can use a variable to get all the conditions defined in the Query as an array, and set the state of the condition in SAP BusinessObjects Design Studio as active or inactive.

E.g.:

//Storing all the conditions on the data source to a variable
    var condition = DS_1.getMeasureFilters();
condition.forEach(function(element, index)
{
//Setting  the required condition as active
if(DS_1.getMeasureFilterName(element)==”CONDITION1″)
{
DS_1.setMeasureFilterActive(element, true);}
else
{
DS_1.setMeasureFilterActive(element, false);}
});

In the above example only the condition with name CONDITION1 is active and all other conditions are inactive.

*This approach can also be used in conditions with variables if necessary.

Consider a scenario when Top N and Bottom N are to be reported.

We can define 2 conditions; one for Top N and other for Bottom N in the same query. And in SAP BusinessObjects Design Studio, we can toggle the condition states to display the Top N and Bottom N as and when required.

/wp-content/uploads/2015/07/conditions_in_sap_bex_745864.png

To Display Top N use the following script:

DS_1.setMeasureFilterActive(“ADM”, false);
DS_1.setMeasureFilterActive(“CONDITION1”, true);

To Display Bottom N use the following script:

DS_1.setMeasureFilterActive(“CONDITION1”, false);
DS_1.setMeasureFilterActive(“ADM”, true);

This eliminates the need of 2 data sources with each of the conditions given separately.

To report this post you need to login first.

2 Comments

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

  1. Mustafa Bensan

    A very helpful and clear write-up indeed, Noel.  It’s probably worth noting that there may also be scenarios in which multiple conditions are required to be activated simultaneously when needed, which should be fine as long as they don’t clash with each other (although there are rules of priority that are applied in such cases anyway).

    Regards,

    Mustafa.

    (0) 

Leave a Reply