cancel
Showing results for 
Search instead for 
Did you mean: 

DropDownByKey

Former Member
0 Kudos

Hello all,

I have a requirement of filling the DropDownByKey UI Element with certain data. This data resides in a node for me. The node structure is as follows:

Vn_Node

--> Va_Code

--> Va_Description

I want to display the codes in the Vn_Node node held up in Va_Code value attribute. How do i do it? Do i need to write in any code for the same?

Regards,

Yogesh Bhatia

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You do not need to write any code for this. Just assoicate Va_Code attribut to data source property of UI element drop down by key and make sure that node is populated.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Yogesh,

There might be some property 'Selected Key' in your UI element.Choose the value attribute which you need to bind . Then it will appear like Vn_Node.Va_Code .

Kindly check whether the node is populated by printing the size of the node.

wdComponentAPI.getMessageManager().reportSuccess("Size"+wdContext.nodeVn_Node.size());

Refer this link for detailed explanation of Dropdownby Key ui element

http://help.sap.com/erp2005_ehp_04/helpdata/EN/08/13dbfb6e779743bb2ca641ebcb3411/content.htm

Why dont you use DropDownbyIndex?

What is your requirement?

Best Wishes

Idhaya R

Edited by: IdhayaR on Jun 16, 2009 3:16 PM

Former Member
0 Kudos

If you already have the ndoe,then node DropdownbyIndex isntead of DropdownbyKey.

For drodownbyindex u do not need any code instead bind to the description attrib.But then you will not have code assigned for the same.You only need to get the selected item by nodes' lead selection

But if you wish to have ket and value,use the following code to loop through the node and add to the dropdown key.

Create a context attibe say dropdownValue of type string and binf to the key property of dropdown by key. And the use the following code

IWDAttributeInfo attributeInfo =wdContext.getNodeInfo().getAttribute(dropdownValue); 
	ISimpleTypeModifiable objType = attributeInfo.getModifiableSimpleType();
 
	IModifiableSimpleValueSet valueSet =
			objType.getSVServices().getModifiableSimpleValueSet();
	
	valueSet.clear();
	wdContext.<ur node>.moveFirst();	
	for(int i=0;wdContext.<ur node>.!=null && i<wdContext.<ur node>..size();i++)
	{
		
		valueSet.put(wdContext.<ur node>.getCurrentElement().getAttributeAsText(key),	wdContext.<ur node>.getCurrentElement().getAttributeAsText(value));
			wdContext.<ur node>.moveNext();
	}

Edited by: Santhosh Edla on Jun 16, 2009 9:08 AM

Former Member
0 Kudos

hi,

Can u just explain me from you want to take the value for the drop down. Is it from Dictionary simple type

or from any table.

If that is from simple type means you have to map that simple type to the context and map the context value attribute to selected key property of drop down by key.

If from table then you have to write code.

Regards,

H.V.Swathi

Former Member
0 Kudos

Hello Swathi,

I want to take the value for the drop down from the data present in the node. Node has one value attribute which is of type string. Wat code do i need to write for the same?

As for the first reply i am using NWDS 7.0, and there is no data source property that i can find for DropDownByKey UI element.

Former Member
0 Kudos

If you have a node with one value then use dropdownByIndex instead of dropdownByKey.

Just bind texts property to the value attrib under node.

You should get the dropdown filled when u run the app after this..

Hope it helps

Former Member
0 Kudos

Hi,

U can go through this code and follow.

IWDAttributeInfo a1=wdContext.getNodeInfo().getAttribute(IPublicNewTestComp.IContextElement.DDBYKEY);
    	ISimpleTypeModifiable stm1=a1.getModifiableSimpleType();
    	IModifiableSimpleValueSet svs1=stm1.getSVServices().getModifiableSimpleValueSet();
    	
    	svs1.put("1","One");
		svs1.put("2","Two");

Regards,

H.V.Swathi