cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown box values

former_member342346
Participant
0 Kudos

Hi all,

I have a dropdown box which gets values from datasouce in the following way:

DROPDOWN_YR.setItems(DS_1.getMemberList("0CALYEAR", MemberPresentation.EXTERNAL_KEY, MemberDisplay.TEXT, 5));

The result I get is: 2010, 2011, 2012, 2013, 2014.

I want to display only last 3 years: meaning: 2012, 2013, 2014.

Is there a way to sort the result in a descending order and filter only last 3 years?

Or - is there another way to achieve this goal?

Thanks,

Hagit

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Hagit,

I can't check it right now, but it seems you can use sort(false), for descending order and maxNumber parameter to 3 in order to limit the list to three values.

Thanks,

eitan

Former Member
0 Kudos

Hi Hagit,

I do not know of any sorting functionality in script Eitan is mentioning.

However, if you are only using the last 3 years, you would probably be better off from a performance point of view to filter in your BEx query on the last 3 years (using variables ofcourse).

Kind regards,

Sjoerd

Former Member
0 Kudos

Hi Sjored,

Please see attached screenshot.

I do agree with your advise regarding performance.

Former Member
0 Kudos

Hi Eitan,

The sorting applies to the dropdown box, not to the datasource. The values are already in the dropdown box when you sort, so too much values are present at that time already. Unfortunately, there's no script function to limit the number of values in the dropdown box, other than the setItems option.

Kind regards,

Sjoerd

Former Member
0 Kudos

I understand what you're saying, I stand corrected.

former_member342346
Participant
0 Kudos

Thank you both Eitan and Sjoerd.

But I'm kind of confused now - I also noticed the "Sort" option Eitan displayed in his screenshot.

Can I fill the dropdown, sort it and than limit the number of values to display?

Sjoerd - what for you mean by "setItems option."



former_member342346
Participant
0 Kudos

Sjoerd - another thing regarding your suggestion: " you would probably be better off from a performance point of view to filter in your BEx query on the last 3 years"

I've noticed that although my variable related to specific years, the values arrive to the dropdown are different, I get the whole years available in my DSO.

My variable is interval of previous to current year, but the dropdown list shows all years between 2010 and 2014.

please take a look at the screenshot attached:

Former Member
0 Kudos

Hi, Please attach a screenshot of your variable as well, so we can see if there's something wrong there.

Sjoerd

Former Member
0 Kudos

Unfortunately you cannot set the number of items in script after initially filling it with the dropdown_1.setItems function.

Sjoerd

former_member342346
Participant
0 Kudos

Hi Sjoerd,

The variable is a customer exit which calculates the current year.

The problem is that the characteristic 0CALYEAR relates to the posted values, so actually it displays all values available in my info-provider.


If you look in the screenshot I've attached in my previous post you will notice that design studio related to the left list of years.


Can I save the result in a temporary array and than pass the values I need to the dropdown?


Thanks again,

Hagit