cancel
Showing results for 
Search instead for 
Did you mean: 

set leadselection for dropdown by key

Former Member
0 Kudos

maintained the values as simple data types under dictionary. How to preset the dropdown with a particular value by default instead of empty line. Thanks!.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pankaj,

Check this

Regards,Anilkumar

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Pankaj,

You can do this dynamically n set the initial value to any of the value,

use the following code:-

Say you have an attribute 'drop_by_key' mapped to the dropdown by key UI element. Then you can set the first key as selected as

String attributeName = IPrivateMyTestView.IContextElement.DROP__BY__KEY;

IWDAttributeInfo attributeInfo = wdThis.wdGetContext().getNodeInfo().getAttribute(attributeName);

ISimpleType simpleType = attributeInfo.getSimpleType();

ISimpleValueSet valueset = simpleType.getSVServices().getValues();

valueset.putValues("<Insert values in value set>");

Object key = valueset.getKey(0);

wdContext.currentContextElement().setDrop_by_key((String)key);

this way you can assign any value in the getKey() function ..

Hope this helps

Regards

Jeet.

Former Member
0 Kudos

Hi

Before populating the values into dropdown set a value for context attribute.

wdContext.currentContextElement.setV_Name ("Select a value");

and then populate your list according to your requirement.

Former Member
0 Kudos

Thanks.. it solved my issue.

Former Member
0 Kudos

Hi Pankaj,

Set the key of the value you want to display, to the context variable of drop down.Then the corresponding value will be displayed

ie. If u r having key-Value pairs like

Key1-->Value1

Key2-->Value2

then, inorder to display Value2 at start,

assign Key2 to the context of dropdownByKey

ie. wdContext.currentContextElement().set<con.Var>(Key2);

Regards

Fahad Hamsa