cancel
Showing results for 
Search instead for 
Did you mean: 

Unique data in drop Down

Former Member
0 Kudos

Experts,

In dropdown I am getting duplicate data . I need only unique data.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Before loading the values to dropdown, please pass the values to the "HashSet". Load the result of the Hashset to the Dropdown.

Regards,

Saravanan K

Former Member
0 Kudos

Thanks A lot for the fast reply...

But my concern is that i am directly mapping the model node to my view page. So i have not use the use the set fields.After search button i am retrieving data in drop down. So how to do this?.

Is there any solution to make it unique or i need to use node.

Former Member
0 Kudos

Hi friend,

You should ideally use the local node because using the model node directly to view is violation of MVC architecture.

and you can't manipulate model nodes also because of 0-n cardinality. better you should use the local node. And if you don't want to set the values in attribute manually you can use wdCopyService. Let us know if any issue.

Regards

Jeetendra

Former Member
0 Kudos

Hi friend, i still dont understand why you have out classed de use of drop down by key to eliminate duplicate entries from drop down.

Regards,

Tushar Sinha

Former Member
0 Kudos

Hi Friend,

You can use this code for storing the unique values from the attribute in which you have duplicate values.


 ArrayList uniqueVals = new ArrayList();
	  
	  for (Object x : myList)
	      if (!uniqueVals.contains(x))
	          uniqueVals.add(x);

	  for(int i =0;i<uniqueVals.size();i++){
	  wdContext.currentContextElement().setValue(uniqueVals.get(i).toString());
	  }

Now after that you can bind the drop down with the Value attribute.

Give it a try and let us know if any issue persist.

Regards

Jeetendra