Skip to Content

Static and Dynamic value for a drop down simultaneously

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 11, 2016 at 12:34 PM

    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 ?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Nitesh Kumar

      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

  • author's profile photo Former Member
    Former Member
    Posted on Feb 15, 2016 at 02:47 PM

    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)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 15, 2016 at 06:27 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 15, 2016 at 09:39 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • author's profile photo Former Member
    Former Member
    Posted on Feb 16, 2016 at 05:22 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Nitesh Kumar

      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

      DD.JPG (21.3 kB)
  • Posted on Feb 16, 2016 at 10:18 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.