cancel
Showing results for 
Search instead for 
Did you mean: 

Difference b/w DropDownByIndex and DropDownByKey

Former Member
0 Kudos

Hi All,

What is the difference between DropDownByIndex and DropDownByKey.

Regards

Nikhil Bansal

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Please search the forum, this has been answered 100 times.

Armin

Former Member
0 Kudos

Hi

DropDownByKey provides static data in DropDown and DropDownByIndex makes it dynamic.

<b>DropDownByKey</b>: Is used when u want to use data dictionary type.For this create a dictionary of simple type in the dictionary.

Creating the Simple Type:

Ur project>dictionaries>Data Types-->Simple Types right click and select Create Simple Type.

After entering the name and package, open that and click on "enumeration" tab at the bottom of the same. Now add the Value and Description to be displayed.The created simple type can be used for DropDownByKey.

Binding it to the UI element:

Now create a valueattribute and change the type to the dictionary type(created simple type). Finally bind the DropDownByKey UI element to the value attribute.

<b>DropDownByIndex:</b> Is used while we have to get the data from the database. Here we directly bind the DropDownByIndex UI element to the context node(attribute).

Regards,

Jhansi

Former Member
0 Kudos

Hi Nikhil,

Dropdown by key is a UI element which is having key-value pair. You can put this key- value using the SVS service or from the dictionary simple type.

One context variable(not a node) is sufficient to store all the values for this.

If u r using dictionary values, assign the dictionary type to this context variable.

For SVS, load the values to this context variable using the code.

Then bind this context variable to DrodownbyKey's Value.

For a dropdown by key, after loading the values( either from dictionary or by SVS ) , if you get the value, you will be getting the key for the corresponding value.

In the same way, if u set a key present in dropdown, it will automatically display the corresponding value.

Dropdown by Index gets the value from node.There is no key-value pair. We can load the values to it in the same way we load values to a table.(ie. By from a context node)

Thanks

Fahad Hamsa

Former Member
0 Kudos

Hi Fahad,

Thanks for the reply.

You said that DropDownByKey has key value pair. When I do create a simple type in DD then I give text and description. What is stored as key and value.

Can you please throw some more light on storage of key value pair.

Regards

Nikhil Bansal

Former Member
0 Kudos

Unfortunately, there is a rather confusing terminology.

In the enumeration editor in NWDS, the <b>key </b>is called "Value" and the <b>value </b>is called "Description".

The UI element DropDownByKey displays the values ("Descriptions") and stores the keys ("Value") internally.

Armin