Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!