Estoy tratando de filtrar elementos de la lista de puntos compartidos utilizando un filtro API REST y condiciones de JavaScript. Cuando uso == no funciona, solo si uso !=.
var requestUri = "/_api/web/Lists/GetByTitle('Request For Information')/items?$filter=substringof('" + myQry + "',RFI_nummer)&$orderby=LTIOV asc";
Básicamente, filtro los elementos cuyo RFI_nummer contiene 2022 y los clasifico en LTIOV (que es un campo de fecha)
luego establezco más condiciones como esta:
$.each(data.d.results, function (i, item){ var stat = item.MijnStatus; var tit = item.Title; var start = item.Created.substring(0, 10); var LTIOV = item.LTIOV.substring(0, 10); var RFInum = item.RFI_nummer; if (stat !="Completed") { var start = parseDate(start); var end = parseDate(LTIOV); if (end <= today.getTime()) { balk_kleur = "ganttRed"; } else { balk_kleur = "ganttGreen"; } demoSource.push({ name: RFInum, desc: LTIOV, values: [{ from: start, to: end, label: tit, customClass: balk_kleur, dataObj: stat }], }); } }) //$.each function parseDate(input) { var str = input.split('-'); var sDate = Date.UTC(str[0], str[1]-1,str[2]); return sDate; } });
Cuando trato de reemplazar if (stat !="Completed")
con if (stat =="In Action")
no me da los elementos correctos. ¿Qué estoy haciendo mal?