Hi All,
Im trying to use the code below to retrieve duplicate valuesof the Line field in my sharepoint list
function getListItems(url, listname, query, complete, failure) { $.ajax({ url: url + "/_api/web/lists/getbytitle('" + listname + "')/items" + query, method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { complete(data.d); }, error: function (data) { failure(data); } }); } getListItems('https://site','Test','?$top=5', function(items){ //I can get the arrays here, how can i retrieve the item values console.log(items) var Names = groupBy(items,'Line');
//This give me undefined error console.log(Names) }, function(error){ console.log(JSON.stringify(error)); } ); function groupBy(items,propertyName) { var result = []; $.each(items, function(index, item) { if ($.inArray(item[propertyName], result)==-1) { result.push(item[propertyName]); } }); return result; }