Using non-standard HL7 delimiters

Added by iNTERFACEWARE

How to generate an HL7 message with non-standard delimiters and/or escaping, using serialize.lua

Source Code
require 'hl7.serialize'

function main(Data)
   Msg, Name = hl7.parse{vmd = 'example\\demo.vmd', data = Data}
   
   -- the examples demonstrate how to use hl7.serialize{{}   
   -- NOTE: you will need to customize the code to use delimiters
   -- and/or escape characters to match your requirements
   
   -- use default delimiters
   local Out = hl7.serialize{data = Msg}
   
   -- use non-standard delimiters
   Out = hl7.serialize{data = Msg, 
      delimiters = {'\n', '#', '.', '&', '\'', '*'}}

   -- use different non-standard delimiters
   Out = hl7.serialize{data = Msg, 
      delimiters = {'A', '|', '^', '~', '\\', '&'}}
   
   -- use non-standard escape characters (to escape delimiters)
   Out = hl7.serialize{data = Msg, 
      escaped = {'A', 'B', 'C', 'D', 'E'}}
   
   -- use non-standard delimiters and escape characters
   Out = hl7.serialize{data = Msg, 
      delimiters = {'\n', '&', '\\', '}', '~', '^'},
      escaped = {'A', 'B', 'C', 'D', 'E'}}
      
   -- transmit the messsage:
   --  - push message to queue then send with LLP Client
   --  - push to a web service
   --  - etc
end
Description
How to generate an HL7 message with non-standard delimiters and/or escaping, using serialize.lua