Announcement

Collapse
No announcement yet.

"msg" is not defined error

Collapse
X
 
  • 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 1.6.1.2750

    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:

    Code:
    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) {
         logger.info(obxi + ' instance of OBX.5.1 = ' + msg['OBX']['OBX.5']['OBX.5.1'][obxi]);
      } 
    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|20|CE|104476~~~83|1|217~Never||||||R|||20071130133344-1000
    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.

    Comment


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

      bobf,

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

      Thanks.

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

      Comment


      • #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.

        Comment


        • #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:
          Code:
          var msg = channelMap.get('msg');
          Chris Lang

          Comment


          • #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.

            Comment

            Working...
            X