Page 1 of 1

Remove Duplicates or Display Unique Values(Solved)

Posted: Thu Oct 08, 2015 9:57 am
by taucher

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.


Remove Duplicates or Display Unique Values(Solved)

Posted: Thu Oct 08, 2015 4:27 pm
by Serhii Kulibaba

Hello,

Does this code work? What is the issue?


Remove Duplicates or Display Unique Values(Solved)

Posted: Thu Oct 08, 2015 5:17 pm
by taucher

Yes. It works.


Remove Duplicates or Display Unique Values(Solved)

Posted: Thu Oct 08, 2015 6:44 pm
by Evgene Karachevtsev

Hello Taucher,

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


Remove Duplicates or Display Unique Values(Solved)

Posted: Thu Oct 20, 2016 8:59 pm
by Austin Troth

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


Remove Duplicates or Display Unique Values(Solved)

Posted: Thu Mar 02, 2017 2:37 am
by Frank Dosh

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.


Remove Duplicates or Display Unique Values(Solved)

Posted: Fri Mar 03, 2017 2:40 pm
by Serhii Kulibaba

Hello,

It seems a name of the select component