cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the description from dropdown list

Former Member
0 Kudos

hi sdns,

Just a quick check. My WD program have a set of dropdown list (by key) which is derived and populated by a complex series of logic.

Now I need to update a textview of the description of dropdown list I select. I don't want to go through the complex codes again just to retrieve te descriptions but I want to directly access to the valueset to retrieve the description. I tried "gettext()" but it's giving me error.

Anyone kind enough to provide me some snippet of codes to directly access to the selected description of my dropdown list? points will be awarded for useful answers....thanks.

Jansen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jansen,

Let the attribute bound to DDKey be Val in Context.

You will be putting key-value to DDKey by

IWDAttributeInfo boutiqueInfo=wdContext.getNodeInfo()..getAttribute(IPrivate<View>.IContextElement.VAL);

ISimpleTypeModifiable stf1=boutiqueInfo.getModifiableSimpleType();

IModifiableSimpleValueSet svs=stf1.getSVServices().getModifiableSimpleValueSet();

To get the text of the dropDown, first get the key of the dropDown selected by

String key=wdContext.currentContextElement.getVal();

Now u can get the value of this key from the SVS variable of DDby Key

String ddValue=svs.getText(key);

The key is case sensitive, so ensure the case also.

U can check the existence of the key by

if(svs.containsKey(key))

and value by

if(svs.containsText(key))

Regards

Fahad Hamsa

Former Member
0 Kudos

Thanks Fahad..your code works brilliantly

points awarded!!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jansen,

For updating the textview ,u can make the context attribute(which is binded to text view) as calculated ,When u change the property of the attribute as calculated,it will create getter & setter methods.U can get the key from the SimpleType of the context attribute & get the description by passing the key in setter method.

regards

Sumit

Former Member
0 Kudos

thank sumit for your suggestion but unfortunate that cannot be done as my textview is to be concatenated with other values. Also my dropdown list values are non-string so direct binding.

I need to directly access to the text of the selected value then do this concatentating to get the final output of the textview.