cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically population for DropDownByKey

Former Member
0 Kudos

Hello folks,

Does someone know how to fill DropDownByKey component dynamically, i.e. how to fill it without entering static values. I would like to use Simple Value Selector that I fill by calling some RFC and not by static population of Value, Description pair. Thanks in advance.

Kind Regards,

Aleksandar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

Create a value attribute(Say DDValue) of type string and bind it to value property of DDByKey.

Then after calling RFC, do the following

IWDAttributeInfo att=wdContext.getNodeInfo().getAttribute(IPrivate<ViewName>View.IContextElement.DDValue);

ISimpleTypeModifiable ss=att.getModifiableSimpleType();

IModifiableSimpleValueSet sss=ss.getSVServices().getModifiableSimpleValueSet();

for(int i=0;i<rfcMasterNode.size();i++)

{

rfcEl=rfcMasterNode.getrfcMasterElementAt(i);

sss.put(""+rfcEl.getKeyattrib(),rfcEl.getValueAttrib());//PUTTING KEY AND VALUE FROM RFC Node

}

Regards

Fahad Hansa

Former Member
0 Kudos

Hi Fahad,

Thank you very much for your help but that code will create Extended Value Selector, and I would like to fill Simple Value Selector. Thanks again.

Regards,

Aleksandar

monalisa_biswal
Contributor
0 Kudos

Methods for populating extended value selector and simple value selector are same. It only depends on which UI element u r goint to bind the value attribute.

Input Field behaves like extended value selector (EVS).

Drop Down by Key behaves like Simple Value Selector(SVS).

Former Member
0 Kudos

Hi,

You can use DropDownByIndex(DDBI) also for your key,Description pair,

provided that a single node has both key,Value as attributes.

From your model node map the attribute that you want to display as

description in the DropDown with the texts property of DropDownByIndex.

After the value is slelected in the drop down get the key value as

wdContext.current<Node>Element.getKey();

This will return you the key of the selected description.

Say,

Context

+ Product (RFC node)

---ProductID (key attribute)

---ProductName (description attribute)

Map the attribute ProductName with the texts property of the DDBI.

Thats all.No coding nothing.

In the action where you want the key of the selected value

wdContext.currentProductElement.getProductID();

try this and let me know

Answers (3)

Answers (3)

Former Member
0 Kudos

Hai ,

You use DDBK when you are going to display static data like countries, states..

better to use DDBIndex for Dynamic values

context

|-AA

|-a

bind a to DDBI

String arr[]={"a","b","c"};
for(int i=0;i<arr.length;i++){
IPrivateXXView.IAAElement ele=wdContext.createAAElement();// here AA is the node 
ele.setA(arr<i>);
wdContext.nodeAA().addElement(ele);

}

Regards,

Naga

PradeepBondla
Active Contributor
0 Kudos

Hi,

If you dont want "drop down by Key", You can take "drop down by index" for this you just need to map the drop down by index to your model nodes attribute.

PradeepBondla
Active Contributor
0 Kudos

Hope your problem is solved. right?