cancel
Showing results for 
Search instead for 
Did you mean: 

How to show only six values in dropdown box in design studio 1.3

Former Member
0 Kudos

Hi,

There was an requirement from our client to show only last six months in the drop down, when actually there is almost past 30 months are coming from the database. The data format also looks similar to "2014007", "2014006:..etc. Any idea to achieve this through loop.?

Thank You,

Palani

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Palanikumar,

You need to do this in the query , if you are using Bex , create a variable for  MONTH , and restrict it  as greater than or equal to >= the variable, and create an offset of -6.

Say your cal month variable will be September that is 201409 now it is greater than or equal to September to current date , when you create an offset of -6, it is march 201403 Now it is greater than or equal March till current month .Now you can use this data in Design Studio to feed the dropdown/listbox.

if you are looking at doing in Design Studio instead of the query level, you need to use arrays and do a small work around You can take a look at this blog which has a similar concept dealing with first N items in a list box,

Thanks ,
Karthik Swaminathan

Karol-K
Advisor
Advisor
0 Kudos

Hi,

other option in release 1.3:

in 1.3 release you can find a method DS_1.getMembers(...); this is bringing up a loopable array of members -> you can loop on it and select only those you like (eg. first 6).

then, use the function DROPDOWN.addItem(...); to insert the items into drop down.

Karol

manfred_schwarz
Explorer
0 Kudos

Hi Karol,

I like your idea, but i have difficulties to use it

i have a datasource DS_2 and i just want to show specific Members of my keyfigures.

When i fill my dropdown with this code it just gets empty and returns an error. Somehow i have to say if i want to show the Key or Text ?

i also need this infiormation to be able to compare my elements in the if clause ?!

Can you help me out ?

Best regards

Manfred

DS_2.getMembers("003N81FHQ23D64UTALOPW7MVN",0).forEach(function(element, index) {

DROPDOWN_2.addItem(index, element);

/*  if ((element == value1) || (expression2 == value2)) {

   if_statements

  } else {

   else_statements

  }

  */

});

EDIT ....

I've found the way how to access the keys and values ... i have to define an array and then i am able to access the internal keys and Text.

Just for others searching ....

var ArrayMem = DS_2.getMembers("003N81FHQ23D64UTALOPW7MVN",0);

DROPDOWN_2.addItem("#", "No Filter");

ArrayMem.forEach(function(element, index) {

  if ((element.text == "Anzahl Sätze") || (element.text == "Gepäckgewicht")) {

   DROPDOWN_2.addItem(element.internalKey, element.internalKey + " - " + element.text);

  }

});

This SCN article helped me out: http://scn.sap.com/community/businessobjects-design-studio/blog/2014/09/19/learn-about-arrays-in-des...

Best regards

Manfred

Former Member
0 Kudos

Hi Palani,

You can limit the no of members which get populated in the List box by,

LISTBOX_1.setItems(DS_1.getMemberList("OD_CUSTOMER", MemberPresentation.KEY, MemberDisplay.TEXT_KEY, 6));

Whatever you sort in the Query it gets reflected on the Design Studio, so if you sort it Descending you should be able to get only the First 6 members.

Regards,

Fazith Ali Z