Skip to Content
0

Design Studio - Filtering based on keyfigure Value

Feb 20, 2017 at 03:11 AM

57

avatar image

Hi All,

We have a Design Studio report based on BEx as DS, in this we have multiple Keyfigure among all we need to filter the DS based on one keyfigure having value ZERO.


e.g: Keyfigure 1 have zero for two line-items. so by applying the filter the ds need to show only the line which have zero in keyfigure1.


Code tried by using Button:

var Material_Cust = DS_1.getMembers("ZCUST", 1000000);

var combination="";

var Processed_Qty=0.0;

var Material_Count=Material_Cust.length;

Material_Cust.forEach(function(element, index) { if (Material_Count!=0)

{

Processed_Qty=DS_1.getData("00O2TL1OSOOZ59IB2A3QUN0D6", {"ZCUST": element.internalKey}).value;

if (Processed_Qty==0)

{ combination=combination+ element.internalKey + ";";
Material_Count=Material_Count-1; }

}

} );

DS_1.setFilter("ZCUST", combination.split(";"));

PLEASE HELP ME ON THIS...


Thanks!

Regards,

Ramesh Jothimani

example.jpg (38.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Mustafa Bensan Feb 20, 2017 at 05:39 AM
0

Hi Ramesh,

Since Design Studio does not yet support filtering by script on measures, the code to workaround this can be quite inefficient and cumbersome, especially if you use getMembers() for a large number of values. As your data source is a BEx Query, the most efficient approach would be to define a BEx Condition to return only rows where Key Figure 1 is zero. Is there a reason why you have not considered this instead of scripting?

That being said, when I read through your script, I notice that you have a counter variable, Material_Count which is decremented only when the Processed_Qty (which presumably is Key Figure 1) value is 0. What is the purpose of this counter? It seems redundant given that you have to loop through all members of ZCUST to perform the key figure value check anyway.

Also, for debugging purposes have you executed an application alert message to check the content of the combination string at the conclusion of the loop?

Regards,

Mustafa.

Share
10 |10000 characters needed characters left characters exceeded