Using the Warnings returned from hl7.parse{}

One of our customers wanted to return HL7 parse Warnings and return them to an ACK message. This page shows how to get the parse Warnings, so you include them in an ACK message, or save them to file, or do any other processing that you wish.

Iguana Annotations show the returns from functions (among other things). As you can see the third return from hl7.parse{} contains the Warnings we want to use:

To use the Warnings, all you have to do is to accept the third return value from hl7.parse{}, this return contains an array of warnings.

function main(Data)
   local Msg, Msg, Warnings = hl7.parse{vmd='example/demo.vmd', data=Data}

   local warnings = ''
   for i,Warning in ipairs(Warnings) do
      trace(Warning.description)
      -- Process individual Warning.description however you want
      -- Log each warning, save to file, etc

      -- you can concatenate all warnings in a string
      warnings = warnings..' [W'..i..']'..Warning.description
   end

   -- process warnings string, put in ACK, save to file, log etc
   trace (warnings)
end

Additional Information

Please search our wiki for various ways you might want to process the warning messages. For example:

Please contact support at support@interfaceware.com if you need more help.