web stats
Optional HL7 segments? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-20-2017, 08:11 AM
psanders psanders is offline
OBX.2 Kenobi
 
Join Date: Nov 2011
Posts: 55
psanders is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 03-20-2017, 08:25 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 832
siddharth is on a distinguished road
Default

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
}
Reply With Quote
  #3  
Old 03-20-2017, 09:17 AM
psanders psanders is offline
OBX.2 Kenobi
 
Join Date: Nov 2011
Posts: 55
psanders is on a distinguished road
Default

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
}
Reply With Quote
Reply

Tags
hl7 segment, optional, undefined

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 05:08 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation