I want to create a dashboard indicating when all items in a list are equal to "Yes". For testing I am innerHtmling Done/Not Done. The logic seems to work , but I am afraid the code is testing the list as a whole and not the individual items. I am using choice columns.
Am I missing a loop?
<h1 id="yes/no"></h1>
$(document).ready(function() {
arrayIn_OutItems();
});
function arrayIn_OutItems(){
var siteUrl = "https:xxx/_api/web/lists/GetByTitle('listName')/items?$select="Title,Office,HR,Accounting;
var array = []
$.ajax({
url: siteUrl,
type: "GET",
async: false,
headers: {
"accept": "application/json;odata=verbose"
},
success: function (data) {
array = data.d.results;
console.log(array);
var isYes =
for(var i = 0;array[i].length < 0;i++{
array.every(function (e) {
return e == "Yes"
});
}
if(isYes == true){
document.getElementById('yes/no').innerHTML = "Done";
}else{
document.getElementById('yes/no').innerHTML = "Not Done";
}
},
error: function (err) {
console.log(err);
}
});
}