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

142
Vistas
Mirth Javascript How to set value if received value is in an array

What I need to do is very simple. I need to set the PV1-2.1 value if the received PV1-18.1 value is in a list of values. I set my variable to an array of those values but the check doesn't seem to be working

var type = ['YB','ES','EO','SO','CX']
if msg['PV1']['PV1.18']['PV1.18.1'] = type {
msg['PV1']['PV1.2']['PV1.2.1'] = 'V';
}
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You should try writing your condition as:

    if(type.includes(msg['PV1']['PV1.18']['PV1.18.1'])){
        msg['PV1']['PV1.2']['PV1.2.1'] = 'V';
    }
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can try looping through the array and comparing to each element:

var type = ['YB','ES','EO','SO','CX'];
var i = type.length();

while (i--){
     if (type[i] == msg['PV1']['PV1.18']['PV1.18.1']){
           msg['PV1']['PV1.2']['PV1.2.1'] = 'V';
     }
}
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