#1
|
|||
|
|||
![]()
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! |
#2
|
|||
|
|||
![]()
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! |
#3
|
|||
|
|||
![]()
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] = ...; |
#4
|
|||
|
|||
![]()
Thanks for the reply!
Quote:
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. |
#5
|
|||
|
|||
![]()
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. |
#6
|
|||
|
|||
![]()
Ah, that was the missing piece of the puzzle to get me past this point. Thanks!!
|
![]() |
Thread Tools | |
Display Modes | |
|
|