Filtering messages
Verified
Added by iNTERFACEWARE
How to filter out unwanted HL7 messages (similar principles apply to other message types)
Source Code
function main(Data) -- Parse the HL7 message local Msg, Name = hl7.parse{vmd = 'example/demo.vmd', data = Data} local Out = hl7.message{vmd = 'example/demo.vmd', name=Name} -- Filter out unwanted messages -- In this example we filter out any messages that do not match our VMD -- NOTE: you can use any condition to filter messages if Msg:nodeName() == "Catchall" then iguana.logError('Filtering Message') else -- Map the complete message -- Transform the message -- Push the outgoing message into the Iguana queue end end
Description
How to filter out unwanted HL7 messages (similar principles apply to other message types)
Attachments
Usage Details
This example shows how to filter out unwanted HL7 messages. In this case we filter out any messages that do not match the message definitions in our VMD file. However you can choose any condition (or multiple conditions) to filter out messages.
The process for filtering other message types follows the same general pattern.
How to use the code:
- Use a Filter or To Translator script
- Add the code
- Load the sample messages from sample_data.txt
- Alternatively you can also load the attached project which already contains the sample messages
- Inspect the code and annotations to see how it works
Note: See the Interface Tutorials (Iguana 5 documentation) section for more information on mapping and transforming messages.