How to filter messages
Contents
Ignoring specific messages can be done very easily. Simply omit running the queue.push{data=Data} in a Translator Filter instance for all the HL7 messages you wish to filter out.
You can apply any arbitrary logic you like to exclude messages from being processed. For example:

Here’s the code in a format you can copy.
function main(Data)
local Msg = hl7.parse{data=Data, vmd='demo.vmd'}
if Msg.PID[5][1][1][1]:nodeValue() == 'Adams' then
iguana.logInfo('Adams family not welcome here! Filtering message!')
else
queue.push{data=Data}
end
end
See Also
- Filtering messages – a more comprehensive example from our repository
- Tutorials > Interfaces – tutorials on mapping, translating and filtering messages