taucher
Posts: 0
Joined: Fri Apr 17, 2015 6:06 am

Remove Duplicates or Display Unique Values(Solved)

Hello,

I have a service response with city names and there are duplicated city names in array response. When mapping them to a select component how can i eleminate the duplicated ones or just show the uniques?

Thanks,

I solved with add this js to success response :

code
var cities = {};
var options = Appery("il_select").find("option").each(function() {
if(cities[this.text]) {
$(this).remove();
} else {
cities[this.text] = this.value;
}
});
/code

It can help someone having this issue.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Remove Duplicates or Display Unique Values(Solved)

Hello,

Does this code work? What is the issue?

taucher
Posts: 0
Joined: Fri Apr 17, 2015 6:06 am

Remove Duplicates or Display Unique Values(Solved)

Yes. It works.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Remove Duplicates or Display Unique Values(Solved)

Hello Taucher,

Thank you for sharing, sure it will be useful for others.

Austin Troth
Posts: 0
Joined: Wed Feb 26, 2014 4:54 am

Remove Duplicates or Display Unique Values(Solved)

Could someone identify the "il_select" component? Is this the array or a component? Thanks

Frank Dosh
Posts: 0
Joined: Thu Mar 02, 2017 2:35 am

Remove Duplicates or Display Unique Values(Solved)

The JS doesn't seem to work in success response. Am I missing something, what is "il_select" component? I attempted to use the component name, but no success.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Remove Duplicates or Display Unique Values(Solved)

Hello,

It seems a name of the select component

Return to “Issues”