Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

102
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda