cancel
Showing results for 
Search instead for 
Did you mean: 

Static and Dynamic value for a drop down simultaneously

former_member193085
Participant
0 Kudos

Dear Experts,

I would like to explain my requirement with an example as below:

When the application is loaded, DROPDOWN_1 should display a value from DS_1 which is dynamic. Based on some calculations, default value is selected as below:

Now when we drill down the drodown, it should show the values from a static list like below:

This is confirmed that DS_1 will populate a value which will definitely be present in static list.

Now I am able to populate default value from DS_1; but in doing so, I am getting all the values in DROPDOWN_1 from DS_1 only. I am not able to get the further drilldown values from static list.

I could not find any help regarding this on SCN. Kindly help.

Thanks and Regards,

Nitesh Kumar

Accepted Solutions (0)

Answers (6)

Answers (6)

former_member193085
Participant
0 Kudos

Hello all,

I am trying to make it more clear once more:

Static list - 2010,2011,2012,.......,2020.

DS_1 ---->  It could have any one value which are present in static list.

Suppose DS_1 gives us value 2012.

Now when application is loaded, DROPDOWN should show the value 2012 by default.

When we drill down the dropdown button, it should diplay the years 2010,2011,2012,....,2020.

Thanks and Regards,

Nitesh

Former Member
0 Kudos

Hi Nitesh,

Hard code the codes in your drop down. And then use DS_1.getMemberList("_VsqCcbnwEeWrRM44nAR2dw", MemberPresentation.TEXT, MemberDisplay.TEXT, 1); to get the value and then assign it as selected value to the dropdown.

PS: If you know always is gonna be one value you can leave 1 as it is else you need to change the number but this becomes irrelevant for your case as it will have massive changes.

Ex:

On Startup:


var year =Convert.subString(APPLICATION.getInfo().dateNowInternalFormat,0,4);

DROPDOWN_1.setSelectedValue(year);

INPUTFIELD_1.setValue(year);

Inputfield On Change:


DROPDOWN_1.setSelectedValue(INPUTFIELD_1.getValue());

DropDown Items:

Result on RUNTIME :

Regards,

Bogdan

Former Member
0 Kudos

hi Nitesh,

From what i understand from your query.

  • You need to populate static values - (2010 till 2020) - this you can either set at DD static list or using array of years and using addItem - use both key and text as DD.aditem("2010","2010");

  • Now you have to make the default value as per some calculation. Say curr year is 2016. then you can use setSelectedItem(curryear) - I assume that the default value is one among the static list?

I hope this is what you expect?

Sivakami

former_member193085
Participant
0 Kudos

Dear Sivakami,

You are right. Default value is one among the static list but it need not to be current year. It could be and even could not be. Infact default value could be anything from static list.

Thanks and Regards,

Nitesh

Former Member
0 Kudos

hi Nitesh,

Then i see that your issue can be solved like this

create DD with static list - both key and text as - year number

Then after deriving your default value from the mentioned calculation in your post

say str_default will have default value in string format

Now you can use

DD.setSelectedValue(str_default);

DD.onSelect(); // to perform filtering of datasources based on default

thanks,

Sivakami

Former Member
0 Kudos

Hi Nitesh,

from your statement

////This is confirmed that DS_1 will populate a value which will definitely be present in static list.

I am assuming that your static list is just a subset of the list of years that DS_1 has, and instead of displaying the whole list from DS_1 you want to restrict the dropdown to just show the list of values from the static list.

to do this, you can restrict the DS_1 with your static list.

for ex: DS_1 has a dimension "0YEAR" which has list of values like [2000, 2001, 2002..2030]

and your static list has values [2005, 2006..2015] and instead of displaying all the 30 values in the drop down box you have to display the 10 values from the static list.

apply a filter on the DS1

DS1.setFilterExt("0YEAR",["2005,"2006",.."2015"]);

Thanks

former_member193085
Participant
0 Kudos

Dear Naveen,

No, actually things are reversed. Scenarion is like below:

Static list - 2010,2011,2012,.......,2020.

DS_1 ---->  It could have any one value which are present in static list.

Suppose DS_1 gives us value 2012.

Then when application is loaded, DROPDOWN should show the value 2012 by default.

When we drill down the dropdown button, it should diplay the years 2010,2011,2012,....,2020.

Thanks and Regards,

Nitesh

IngoH
Active Contributor
0 Kudos

Hello Nitesh,

let me try to paraphrase your requirement:

- you have a listbox where you would like to populate a list of years. it does sound you would like to use a static list.

- you also retrieve a value from BW and you would like to use that value as the "default" / selected value.

correct ?

thanks

Ingo Hilgefort, Visual BI

former_member193085
Participant
0 Kudos

Dear Igno,

Your understanding is 100% correct as per my requirement.

Thanks and Regards,

Nitesh

IngoH
Active Contributor
0 Kudos

so you fill the list of values with one data source and set the "selected" value based on the key value received from the other data source.

regards

Ingo

Former Member
0 Kudos

You can also use the Collection component:

  • Loop at DS1,getMembers(year):
    • Coll.addItem(year)
  • Loop at other list (year2)
    • If Coll has not key = year2
      • AddItem(year2)
  • Sort
  • Loop at collection(year3)
    • DD.addItem(year3)
Former Member
0 Kudos

Hi Nitseh,

I think I am missing something ...


Nitesh Kumar wrote:

Now I am able to populate default value from DS_1; but in doing so, I am getting all the values in DROPDOWN_1 from DS_1 only. I am not able to get the further drilldown values from static list.

Could you please explain a bit further your issue ?

So, your DD is not binded right ? The static list you are refering is a range of year, like 2010 to 2030 ?

former_member193085
Participant
0 Kudos

Dear Franck,

Thank you for your reply.

DD is actually bound with static value. I am populating default value writing code at On Startup event.

Further I don't know how to get list values which are from static list.

Yes, it is a range from 2010 to 2020. Binding DD is not required. Any option which give me range like above will be fine.

Thanks and Regards,

Nitesh

former_member193085
Participant
0 Kudos

Dear Franck,

Just trying to make my query more clear.

Can we use 2 sources for a dropdown?

default value from dynamic BW InfoProvider and all other values from static list..

Thanks and Regards,

Nitesh

Former Member
0 Kudos

Hello nitesh,

You will have to use an additional Text component where you will load the list from DS_1 and then concatenate with the list of values of your static list. And then the "merge" values can be loaded into the DropDown

regards,

Bogdan