Sidebar

PID-13 phone multiple occurences. Code works for only first occurence.

0 votes
19 views
asked Oct 2 by douglas-l-4571 (190 points)
This code works fine:    message.setAllNodes('GT1[@6.1=(000)000-0000]-6', '');

This code only blanks out first occurence:

var i = 1;
var pid13Count = StringUtils.splitByWholeSeparator(message.getNode('PID-13'), '~').length;
for (i = 1; i <= pid13Count; i++) {
   message.setAllNodes('PID[@13.1=(000)000-0000]-13[' + i + ']', '');
}

1 Answer

0 votes
var pid13Count = StringUtils.splitByWholeSeparator(message.getNode('PID-13'), '~').length;
for (var i = 0; i < pid13Count; i++) {
   var phoneNumber = message.getNode('PID-13['+(i+1)+'].1');
   qie.debug(phoneNumber);
   if (StringUtils.equalsIgnoreCase(phoneNumber, '(000)000-0000')) {
      message.setNode('PID-13['+(i+1)+'].1', '');
   }
}
answered Oct 2 by michael-h-5027 (11,890 points)
...