Announcement

Collapse
No announcement yet.

JavaScript msg reference problem

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

  • JavaScript msg reference problem

    I have a channel defined with Database Writer destination. I am using JavaScript in the destination connector. It works fine when I create Destination Mappings from my HL7 source file. The following code snip successfully writes to my database:
    Code:
    lSQL = "insert into HL7MSH (MessageId, SendingApplication) ";
    lSQL += "values (" + mID + ", " 
    lSQL += "'" + $('msh_SendingApplication') + "') ";
    var result = dbConn.executeUpdate(lSQL);
    Now I need to implement code for repeating segments. All examples I've seen for doing this on the forum seem to reference the message segments directly:
    Code:
    lSQL = "insert into HL7MSH (MessageId, SendingApplication) ";
    lSQL += "values (" + mID + ", " 
    lSQL += "'" + msg['MSH']['MSH.3']['MSH.3.1'].toString() + "') ";
    var result = dbConn.executeUpdate(lSQL);
    But when I attempt to do this I get the error ReferenceError: "msg" is not defined. Why am I not able to reference the source message in my JavaScript?
Working...
X