Skip to Content
0

Top N ranking in design studio by scripting

Jun 07, 2017 at 05:32 AM

411

avatar image
Former Member

Dear All,

I'm trying to get Top 5 Material Group in an info-chart by using scripting.

To achieve this, I am referring to this blog (https://blogs.sap.com/2016/06/14/implement-top-nbottom-n-in-sap-design-studio-using-bial-script/).

If I sort descending based on CY- Actuals in edit initial view, I get the following results, where the top 5 are 0143, 0279, 0030, 0204 and 0009.

However, by applying the scripting as below, I get different Top 5(0001, 0003, 0002, 0009, # not assigned). The top 5 returned are the first 5 Material Groups sort ascending by key and it rank the first 5 material group according to the CY-Actuals.

Can anyone tell me how can I get the top 5 according to CY- Actuals for all material groups instead of the first 5 material group?

Thank you.

Regards

Pei Shi

u2bwd.png (15.4 kB)
c6emh.png (25.3 kB)
di1ki.png (39.2 kB)
10 |10000 characters needed characters left characters exceeded

Hi Pei. What is your backend data source? From the script it looks like it might be BW. Is that right?

0
Former Member

Hi Mustafa,
Yes, the data source is BW query.

0

Hi Pei Shi Hee,

We are facing the same issue, did you find any solution?

Thanks,

Susan

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Vidhya V Jul 31, 2017 at 09:26 AM
0

Hi Pei Shi Hee,

We have two options,

1. In design studio , while adding the data source, In Edit Query Specification, we can added the ranking filter in the Query Filter panel itself, Please find the below screenshot,

It will work for any Data Source.

After adding this, try to add this script,

	var top10cust=DS_1.getMembers("_eaTRsbh0EeWuS70gbqxHFA", 10);
	DS_1.setFilter("_eaTRsbh0EeWuS70gbqxHFA",top10cust);
	DS_1.sortByMeasure("_NZW_IM7vEeWmlZgk6MSEDA", true);
	TOP10_CHART.setDataSource(DS_1);

2. If it is BW , Using Bex Condition, we can achieve this,

http://visualbi.com/blogs/design-studio/general/working-with-bex-conditions-in-sap-businessobjects-design-studio/

Regards,

Vidhya.C


Share
10 |10000 characters needed characters left characters exceeded