Remove duplicates
Posted: 29 Jun 2020
Hi,
I was wondering if something like the following is possible?
This is obviously wrong, but i just mean in terms of the logic? Is something similar supported?
I was wondering if something like the following is possible?
Code: Select all
function (term, page) {
if (!term || term.length == 0) {
var list = "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$top=5";
var unique = [];
$.each(list, function(index, value){
if(unique.indexOf(value.Title) === -1){
unique.push(value.Title);
}
});
return unique;
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$top=5";
}