web stats
Sending result of one destination to another destination - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-19-2014, 02:08 PM
mby01 mby01 is offline
Mirth Newb
 
Join Date: Jan 2014
Posts: 20
mby01 is on a distinguished road
Default Sending result of one destination to another destination

Folks, I'm probably overthinking this but for the life of me I can't get this to work ...

I have two destination steps in my channel.

The first destination step uses a JavaScript Writer to extract an HL7 message contained in an XML document, and assigns it to a variable. I then write that variable to the channel map with "channelMap.put('hl7', hl7)" so it's available in the next destination. So far so good.

I now want to transform the HL7 contained in that "hl7" variable in destination 2 using a Message Builder transform. How do I access that "hl7" variable so I can do the usual tmp[foo] = msg[bar] type assignments?

Thanks!
Reply With Quote
  #2  
Old 11-19-2014, 02:21 PM
mby01 mby01 is offline
Mirth Newb
 
Join Date: Jan 2014
Posts: 20
mby01 is on a distinguished road
Default

I also need to add that part of my confusion stems from the fact that there doesn't seem to be a way to set the Inbound data type on destination 2 to HL7 unless I change the Outbound data type to HL7 on the Source Connector as well. But that then also changes the Inbound data type for destination 1 to HL7 which is incorrect.

Basically I want the Source Connector to pump out XML to destination 1, and destination 1 to pump out HL7 to destination 2. Hope that makes sense!
Reply With Quote
  #3  
Old 11-19-2014, 02:37 PM
wayneh wayneh is offline
OBX.3 Kenobi
 
Join Date: May 2012
Posts: 102
wayneh is on a distinguished road
Default

All destinations will receive the same message from the source. If you want the Encoded content of the second destination to be the HL7 message, then you would set the outbound datatype of the second destination to HL7, then overwrite the tmp variable entirely and create a new XML object out of it.

tmp = new XML(channelMap.get('hl7'));

Then you could do tmp[foo] = ...

If you're not trying to set this as the encoded content of the second destination, you could assign the XML object to a new variable and then still use the E4X notation

var temp = new XML(channelMap.get('hl7'));
temp[foo] = ...;
Reply With Quote
  #4  
Old 11-19-2014, 03:38 PM
mby01 mby01 is offline
Mirth Newb
 
Join Date: Jan 2014
Posts: 20
mby01 is on a distinguished road
Default

Thanks for the reply!

Quote:
Originally Posted by wayneh View Post
If you want the Encoded content of the second destination to be the HL7 message
I'm probably misunderstanding this but all I really want to do is transform the HL7 I extracted from the XML message in destination 1, in destination 2.

When I do:

tmp = new XML(channelMap.get('hl7'));

In the Javascript Writer in destination 1, Mirth seems to ignore it. Both the raw and encoded messages in destination 2 is still the original XML message.
Reply With Quote
  #5  
Old 11-19-2014, 03:46 PM
wayneh wayneh is offline
OBX.3 Kenobi
 
Join Date: May 2012
Posts: 102
wayneh is on a distinguished road
Default

tmp is not used unless there is an outbound template set. If you want to replace encoded data without an outbound template, use msg instead of tmp

msg = new XML(...)

I did miss one step in between though. You'll have to serialize the HL7 message into XML first before creating the XML object. You can look up the serializer code from the reference list.
Reply With Quote
  #6  
Old 11-19-2014, 04:14 PM
mby01 mby01 is offline
Mirth Newb
 
Join Date: Jan 2014
Posts: 20
mby01 is on a distinguished road
Default

Quote:
Originally Posted by wayneh View Post
You'll have to serialize the HL7 message into XML first before creating the XML object. You can look up the serializer code from the reference list.
Ah, that was the missing piece of the puzzle to get me past this point. Thanks!!
Reply With Quote
Reply

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 11:01 AM.


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