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

98
Vistas
How to check if objects have same properties and then put a total count

I need some help because I'm stuck. If somebody can put me in right direction. the testArr is a much bigger file. But the simple explenation is that I need find the same period and have matching application and based on that have a total count on all payslipCount.

so if I'm searching för a period like '202103' in a date picker. I need to see total paySlipCount for that period and that application. like

     period: 202103 
     pay: Pay100
     amount: total amount
testArr = [
    {application: "PAY100",
    payslipCount: 22,
    period: "202101",
    },
    
    {application: "PAY100",
    payslipCount: 12,
    period: "202101",
    },
    
    {application: "PAY600",
    payslipCount: 0,
    period: "202101",
    },
    
    {application: "PAY600",
    payslipCount: 44,
    period: "202101",
    },
    
    {application: "PAY600",
    payslipCount: 23,
    period: "202103",
    },
    
    {application: "PAY600",
    payslipCount: 44,
    period: "202103",
    },];

I just need somebody to push I in right direction.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Something like this should do the work. You can replace the date with a variable from the form.

testArr.filter(o => o.period == '202101')
       .map(item => item.payslipCount)
       .reduce((prev, next) => prev + next)
about 4 years ago · Juan Pablo Isaza Denunciar
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