Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

193
Vistas
How to Use REST Api and javascript conditions to filter listitems

I am trying to filter sharepoint list items using a REST API filter and javascript conditions. When I use == it doesn't work, only if I use !=.

var requestUri = "/_api/web/Lists/GetByTitle('Request For Information')/items?$filter=substringof('" + myQry + "',RFI_nummer)&$orderby=LTIOV asc";

I basically filter the items of which the RFI_nummer contains 2022 and sort them on LTIOV (which is a date field)

then I set further conditions like this:

        $.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;
               }

        });

When I try to replace if (stat !="Completed") with if (stat =="In Action") it doesn't give me the right items. What am I doing wrong?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda