Announcement

Collapse

Mirth Connect 4.3.0 Released!

Mirth Connect 4.3.0 is now available as an appliance update and on our GitHub page.

This is a major release containing new features like adding new functionality to the Mirth Connect Setup Wizard, adding the ability for resource and channel-specific classloaders to load child-first or parent-first, and added a default implementation of the getObjectsForSwaggerExamples() method in the ServicePlugin class. This release also contains enhancements for the Mirth Connect Administrator Launcher, the Mirth Connect Docker images, and several bug fixes and security improvements.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Replacing + in name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Replacing + in name

    Our registration adds a + symbol to the name in order designate the patient as confidential. Normally they add a space then + and the regex has no issues removing it. But when they don't add a space like SMITH+ it doesn't pick it up I've tried different javascript and the regular expression in the transformer but I can't seem to get it remove the +. The regular expression I have is [&\/\\#+^()$~%\\^\\'":?*@^<>{}()]. Any help would much appreciated.

  • #2
    PHP Code:
    var myField msg['PID']['PID.5']['PID.5.1'].toString();
    myField myField.replace(/[\s\+]*$/, '');
    msg['PID']['PID.5']['PID.5.1'] = myField;​ 
    that will handle extra spaces before or after the plus sign also.
    Diridium Technologies, Inc.
    https://diridium.com

    Comment


    • #3
      Worked great, thank you.
      final code
      var mapping;
      var MIDDLE = msg['PID']['PID.5']['PID.5.1'].toString();
      MIDDLE = MIDDLE.replace(/[\s\+]*$/, '');
      mapping = msg['PID']['PID.5']['PID.5.1'] = MIDDLE;
      channelMap.put('MIDDLE', validate(mapping, '', new Array()));​

      Comment


      • #4
        That can just be with one liners like below if you are just trying to put it in the channelMap and/or assign it back to msg.

        PHP Code:
        $c('middle',msg['PID']['PID.5']['PID.5.1'].toString().replace(/[\s\+]*$/, ''))
        msg['PID']['PID.5']['PID.5.1'] = msg['PID']['PID.5']['PID.5.1'].toString().replace(/[\s\+]*$/, ''

        Looks like you are viewing the generated script from a mapper step. That generated script, while it works, isn't really what you would code yourself.
        Last edited by pacmano; 03-19-2023, 11:11 AM.
        Diridium Technologies, Inc.
        https://diridium.com

        Comment


        • #5
          Thanks pacmano, I realized after I posted that I could apply your solution to the source, which makes way more sense then changing each channel. Appreciate your help on this.

          Comment

          Working...
          X