This topic contains 1 reply, has 2 voices, and was last updated by Eliot Muir 9 years, 1 month ago.
Assigning new value to MSH.10
You must be logged in to reply to this topic.
This topic contains 1 reply, has 2 voices, and was last updated by Eliot Muir 9 years, 1 month ago.
I’m pulling a message out of the logs, and need to pass it back into another channel on the same server. The issue, however, is I need the MessageControlID to be changed. I’ve pulled the message into a translator, I’ve got this so far:
function modMessage(MsgIn) local T = hl7.parse{vmd='HL7_2.7.vmd',data=MsgIn} T.MSH[10] = T.MSH[10]..'_fromHold' MsgIn = tostring(T) return MsgIn end
The error I’m getting is when I’m trying to reassign T.MSH[10], where I get:
Message Control ID is read-only, and cannot have a new value assigned to it.
After I reassign the value, I’ll put it back into a string and send it on its way, but I need to get past this hurdle. My searches in the KB were (as usual) not helpful.
-Robert James,
Interface Analyst,
GetWellNetwork, Inc.
You’ll need to make an HL7 tree you can alter. The trick is to do something like this:
function modMessage(MsgIn)
local Msg = hl7.parse{vmd='HL7_2.7.vmd',data=MsgIn}
local Out = hl7.message{vmd='HL7_2.7.vmd', name = Msg:nodeName()}
Out:mapTree(Msg)
Out.MSH[10] = Out.MSH[10]..'_fromHold'
MsgIn = tostring(Out)
return MsgIn
end
I may have the parameters the wrong way around but that is the general idea. The demo filter channel in Iguana shows this pattern.
You must be logged in to reply to this topic.