Create a custom ACK

Verified
Added by iNTERFACEWARE

Create a custom ACK by using a script in an LLP Listener component

Source Code
-- main() is given the original HL7 message.
function main(Data)
   local Msg = hl7.parse{vmd='ack.vmd', data=Data}
   local Ack = hl7.message{vmd='ack.vmd', name='Ack'}
   Ack.MSH[3][1] = Msg.MSH[5][1]
   Ack.MSH[4][1] = Msg.MSH[6][1]
   Ack.MSH[5][1] = Msg.MSH[3][1]
   Ack.MSH[6][1] = Msg.MSH[4][1]
   Ack.MSH[10] = Msg.MSH[10]
   Ack.MSH[9][1] = 'ACK'
   Ack.MSH[11][1] = 'P'
   Ack.MSH[12][1] = '2.6.1'
   Ack.MSH[7][1] = os.date('%Y%m%d%H%M%S')
 
   Ack.MSA[1] = 'AA'
   Ack.MSA[2] = Msg.MSH[10]
   Ack.MSA[3] = "Everything was okay dokay!"
    
   ack.send(Ack:S())
end
Description
Create a custom ACK by using a script in an LLP Listener component
Usage Details

This code creates a complete ACK message from scratch, mapping each of the fields using Lua.

How to use the code:

  • Create a channel with an LLP Listener component
  • Either load the custom_ACK_LLP_Listener.zip project file or paste in the code
  • Download the ack.vmd file and add it to the project