Skip to Content
0

Set a Default Period for the Drop down Box in SAP Design Studio

Sep 14, 2017 at 07:22 PM

252

avatar image
Former Member

Hi Everyone, i am struck on a requirement and need assistance. I have a HANA view specifically built to populate Month values. Data looks as below

Month Key Month Name

201701 Jan 2017

201702 Feb 2017

201703 Mar 2017

..........................................

201709 Sep 2017

In my Drop down box i want the default value to be shown as Aug 2017. When i used the binding properties to bind the Month Name dimension to the drop down box the default value assigned is Jan 2017. No matter how i sort it in edit initial view it still defaults the Month value as Jan 2017 and Sep 2017 is in the bottom of the list. I tried to change the Sort --> By Member --> By Ascending or Descending and it still shows Jan 2017 as default.

My users are ok if Jan 2017 appears top in the list but default value should be Aug 2017 for the current month. And Sep 2017 should be default when the dashboard is opened in October.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Mustafa Bensan Sep 15, 2017 at 03:55 AM
0

Hi Rajasekhar,

Have you tried using the setSelectedValue() script method of the Dropdown Box to set the desired default value?

Regards,

Mustafa.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Mustafa, yes i tried to use that option. Here is what i did,

In the Application Events --> On StartUp i have written the command DD_1.setSelectedValue("AUG 2017"); to see if it sets the value to August 2017 every time. The command shows no error but when i execute the dashboard the drop down still shows JAN 2017 only.

Also, instead of binding the values in the properties of the dropdown i even tried to bind it in Onstartup again

dd_1.setItems(ds_1.getMemberlist("Month_Name", Memberpresentation.Internal_Key, MemberDisplay.Text, 20));

DD_1.setSelectedValue("AUG 2017");

in both the cases i could not achieve defaulting the dropdown to Aug 2017.

0

Hi Rajasekhar,

When using setSelectedValue(), you need to specify the internal key value, such as "201708" and not the text description "Aug 2017".

Regards,

Mustafa.

0
Nikhil Joy Oct 02, 2017 at 06:38 AM
0

Hi Rajasekhar,

As Mustafa mentioned, you have to give internal key value as setSelectedValue() on startup. In order to make it dynamic based on current month, you can write a simple logic by fetching current date from APPLICATION.getInfo().DateNowInternalformat . That will bring you 20171002 today. substring() and get your month and calculate previous month. Then you can set this variable with year as selected month as per your requirement.

Regards,

Nikhil Joy

Share
10 |10000 characters needed characters left characters exceeded