Announcement

Collapse

NextGen (Mirth) Connect 3.11.0 Released!

NextGen (Mirth) Connect 3.11.0 is now available as an appliance update and on our GitHub page. This release contains improvements to licensing and the NCPDP data type. It also includes various security fixes, general bug fixes, and improvements to commercial extensions. See the release notes for the complete list of fixes and improvements.

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

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

Channel map inconsistancy

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

  • Channel map inconsistancy

    I've got two different javascript transformer steps for two different channels, both steps use channelMap.put but the variable they create is only available to one channel. I don't expect or want them to be available across channels, but each should be available within the channel that creates it. What is happening is the transformer step for the database writer creates a variable that may be used in later steps, but the transformer step for the file writer does not create a variable that can be used in later steps. Why? As far as I can tell there are only minor differences between the two. So what would cause the file writer's transformer step to not create a variable?

    File Writer transformer step:
    Code:
    var firstName  = '';
    if( msg['usrnam'] != null ){
      var thing = msg['usrnam'].toString();
      var stuff = thing.match( /(^\w*)\s(\w*)\s(\w*)/);
      firstName  = RegExp.$1;
    }
    
    channelMap.put( "FirstName",  firstName  );
    Database Writer transformer step:
    Code:
    if( msg['PID']['PID.7']['PID.7.1'] != null &&
        msg['PID']['PID.7']['PID.7.1'].toString() != null){
      var dob = msg['PID']['PID.7']['PID.7.1'].toString();
      var junk = dob.match(/(\d\d\d\d)(\d\d)(\d\d)/);
      channelMap.put("usrBirthDateFmt",
    	RegExp.$1 + '-' + RegExp.$2 + '-' + RegExp.$3 );
    }
    The only other difference is the channel with the database writer is set to use HL7 for incoming and outgoing data while the file writer is set for XML incoming data and HL7 outgoing data.

  • #2
    Re:Channel map inconsistancy

    You have to check for undefined or zero length, not null. (The "msg" object is Javascript object and null is actually undefined).
    Chris Lang

    Comment


    • #3
      Re:Channel map inconsistancy

      That doesn't explain why the database writer works and the file writer does not since they are both checking the same thing. By work I mean that usrBirthDateFmt is available to succeeding transformer steps but FirstName is not.

      Post edited by: wmsTrebor, at: 08/24/2007 06:21

      Comment


      • #4
        Re:Channel map inconsistancy

        Well I found the problem. It's in how channelMap.put is being recognized, it doesn't like spaces between the open parenthesis and the open quote.

        Code:
        channelMap.put("works", "stuff" );
        channelMap.put( "broke", "stuff" );
        The recognition of channelMap.put should not be so strict, it should be recognized for any valid javascript. Even ugly code like this:
        Code:
        channelMap 
         .
         put
         ( "name", "value" );

        Comment


        • #5
          Re:Channel map inconsistancy

          I see your problem -

          The variable is still being created in JS - Mirth's UI just can't parse the steps to show you the helper. It looks for channelMap.put(" as a regular expression to show up in the lists later on.

          Good find - please add this as an issue to the JIRA.

          Also note that you can use $c("key", "value") to put objects in the channel map and $("key") to retrieve objects. This works for $co (connector map) $g (global map) and $r (response map).

          These also suffer from the bug you mentioned and will be fixed in an upcoming release.
          Chris Lang

          Comment

          Working...
          X