Mirth Connect 4.1.0 Released!

Mirth Connect 4.1.0 is now available as an appliance update and on our GitHub page. Mirth Connect 4.1.0 includes new features such as new event log messages, additional fields to the Welcome to Mirth Connect screen, new information included in alerts as well as many smaller changes, updates, and improvements. This release also contains several improvements to commercial extensions. See the release notes for the list of fixes and updates.

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

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

"msg" is not defined error

  • Filter
  • Time
  • Show
Clear All
new posts

  • "msg" is not defined error

    I'm trying to cycle through the OBX segments of a message and save data to an Oracle db. I'm using Mirth version

    I've seen several examples on how to do this on this forum. I'm using the following borrowed code to learn how to do it. But, it won't work on my system.

    Here is the code I'm toying with:

    var obxi = 0;
    var tempOBX = "";
    while (msg['OBX']['OBX.3']['OBX.3.1'][obxi] != null) {
      tempOBX = msg['OBX']['OBX.3']['OBX.3.1'][obxi].toString();
      if (tempOBX.length > 0) { + ' instance of OBX.5.1 = ' + msg['OBX']['OBX.5']['OBX.5.1'][obxi]);
    I keep getting this error:

    ERROR-406: JDBC Connector error
    ERROR MESSAGE: Error writing to database:
    org.mozilla.javascript.EcmaError: ReferenceError: "msg" is not defined. (3c373b63-9c1b-4efa-9f02-3be08c351d4a#8)

    I don't understand why the "msg" error is happening.

    Please help. Thanks.

  • #2
    Re:"msg" is not defined error

    Here is an example of the OBX lines in the actual message:

    OBX|30|CE|104476~~~84|1|222~0 drinks||||||R|||20071130133344-1000
    OBX|40|CE|104476~~~85|1|217~Never||||||R|||2007113 0133344-1000

    I'm interested in saving the data elements in red, for each line.


    • #3
      Re:"msg" is not defined error


      Have you resolved this problem? I am having the same problem and still do not have a solution.


      Post edited by: mkremer, at: 01/17/2008 13:23


      • #4
        Re:"msg" is not defined error

        Your problem is not the HL7 its the msg variable you are using in the for loop.

        However I have no problem using the 'msg' variable in version 1.6 in my HL7--->XML destination transformer using a Javascript step.


        • #5
          Re:"msg" is not defined error

          If you are using this on the DB Writer Javascript, then the error is occurring because MSG isn't valid there. msg is only available in the transformer and filter.

          You can store msg in the transformer with channelMap.put('msg', msg) then in your destination DB Writer do:
          var msg = channelMap.get('msg');
          Chris Lang


          • #6
            Re:"msg" is not defined error

            Thanks for the helpful responses.

            One more question, if I may: Should I perform this kind of processing in the DB Writer code, or as a step in a transformer. My first inclination, and the reason for my initial question, was to process it in the DB Writer. Any suggestions?

            Thanks again.