cancel
Showing results for 
Search instead for 
Did you mean: 

Drop Down BY Index Vs Drop Down By Key

former_member181928
Participant
0 Kudos

What is the difference between Drop Down By Index & Drop Down By Key.

How Do we retrive What value is selected in a drop down

regards

Nilesh

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member181928
Participant
0 Kudos

Thanks for the reply ..

I am making a call to a webservice which returns me 2 fields (a key and a description). I want to populate this data in the drop down box. The Desc should be visible in the box when a particular desc is selected the corresponding key should be returned and not the same selected text.

How can this be implemented.

regards

Nilesh.

Former Member
0 Kudos

Hello Nilesh,

//Create ISimpleTypeModifiable to fill the dropdownbox 
//XXX is your Desc field
			 IWDAttributeInfo soAttribInfo= wdContext.getNodeInfo().getAttribute("XXX");

			 ISimpleTypeModifiable soType = soAttribInfo.getModifiableSimpleType();
			 soType.setFieldLabel("XXXX");
			 IModifiableSimpleValueSet soSet= soType.getSVServices().getModifiableSimpleValueSet();
			 soSet.clear();
		
			 //To Get desc and key from web services you pass some information to the run the given Webservice do it here
			 wdContext.currentRequest_XXXViDocument_getDescnKeyArrayElement().setInfo(infonr);
			 wdThis.wdGetXXXController().getDescObjects();
			 int size = wdContext.nodeResult_getDescObjectsArray().size();
			 if (size != 0)
			 {	
				 //Filling the desc in the dropdownbykey field
				 for (int i=0; i<wdContext.nodeResult_getDescObjectsArray().size(); i++ )
				 {
					 IPrivateXXView.IResult_getDescObjectsArrayElement soElement =
						wdContext.nodeResult_getDescObjectsArray().getResult_getDescObjectsArrayElementAt(i);
			 		 soSet.put(soElement.getkey(),
					 soElement.getDesc().trim() + " " + soElement.getkey().trim() );
				}
			 }

Implement this code for populating the drowdown when that works I can tell you the next step.

Good Luck,

Dharmi

Former Member
0 Kudos

Hi Nilesh,

Drop down bykey is normally used when the drop down data comes from a local dictionary u defined in the application.

Drop down by index in case the data is populated say from a BAPI call.

There might be more fine differences between them which I am yet to discover

Regards

MK