Announcement

Collapse
No announcement yet.

Optional HL7 segments?

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

  • Optional HL7 segments?

    Hi all,

    Using Mirth 3.2.2.7694.

    Have a channel that gets HL7 and inserts fields from the message into a table.

    I am receiving a HL7 message with a segment that is optionally being sent. I had a mapper transformer step for it but kept getting the error that it was undefined when I received a message without that segment. I took that out and added the following javascript code hoping this would solve my problem. but still get the error. "TypeError: Cannot read property "ZRS.1" from undefined"

    var notes = '';
    if(mainmsg['ZRS'])
    {
    notes**=*(mainmsg['ZRS'][count]['ZRS.1']['ZRS.1.1']) ?*(mainmsg['ZRS'][count]['ZRS.1']['ZRS.1.1'] + '').toString() : null;
    }

    Is there a different way I should be handling optional HL7 segments?

    Thanks

  • #2
    Not really sure what that * does. elaborate?

    your code has problems. Try below
    Code:
    var notes = '';
    if(msg['ZRS'])
    {
    notes=msg['ZRS']['ZRS.1']['ZRS.1.1']) ? msg['ZRS']['ZRS.1']['ZRS.1.1'].toString():null; //assuming there is only one ZRS Segment
    }
    HL7v2.7 Certified Control Specialist!

    Comment


    • #3
      hi siddharth, not sure why the copy / paste put those asterisks in there. Regardless, I tried adapting the code you posted but still get the error:

      "Cannot read property "ZRS.1" from undefined"

      if(mainmsg['ZRS'])
      {
      notes=(mainmsg['ZRS']['ZRS.1']['ZRS.1.1']) ? mainmsg['ZRS']['ZRS.1']['ZRS.1.1'].toString():null; //assuming there is only one ZRS Segment
      }

      Comment

      Working...
      X