But sometime we need to add items in Dropdown dynamically, so for this we need to write a code, follow the bellow step to add items to dropdown dynamically.

Create Dropdrown

First add new fresh dropdown from insert tab, and for example your dropdown name is Dropdown_1.

Create Planning_Model

Create Planning model shown in image, then select the model from select models option, where is your dimension is available and need to add on dropdown.

Add Code to Canvas

Go to onInitialization from Canvas, and write the code mention below.

var version_list = PlanningModel_1.getMembers("dimention_name"); // getting dimention item from model

for ( var i=0; i < version_list.length; i++){
            Dropdown_1.addItem (version_list[i].id, version_list[i].description );
}

Dropdown_1.setSelectedKey("id_of_member"); //add id to make item selected by default
Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x