web stats
Mirth Community - View Single Post - How to exclude one msg type from transformer
View Single Post
Old 03-31-2017, 11:20 AM
pmcnally pmcnally is offline
Mirth Newb
Join Date: Dec 2015
Location: Massachusetts
Posts: 9
pmcnally is on a distinguished road
Lightbulb Handling A17 /multiple PID, PV1 & PV2 segments

Not elegant but found a way to handle this message type w/o having errors from PV1 & PV2 transformers (or having them combined).
1. Created new transformer to handle all of the changes to the A17 message type:
if(msg['MSH']['MSH.9']['MSH.9.2'].toString() == 'A17')
delete msg['MSH']['MSH.8']['MSH.8.1'];
delete msg['MSH']['MSH.10']['MSH.10.1'];
delete msg['MSH']['MSH.11']['MSH.11.1'];
delete msg['MSH']['MSH.15']['MSH.15.1'];
delete msg['MSH']['MSH.16']['MSH.16.1'];
delete msg['MSH']['MSH.17']['MSH.17.1'];
delete msg['EVN']['EVN.2']['EVN.2.1'];
delete msg['EVN']['EVN.5'].toString();
delete msg['EVN']['EVN.6']['EVN.6.1'];

if(msg['MSH']['MSH.9']['MSH.9.2'].toString() == 'A17')
for each(pid in msg.PID)
delete pid['PID.1']['PID.1.1'];
delete pid['PID.4']['PID.4.1'];
delete pid['PID.5']['PID.5.4'];
delete pid['PID.5']['PID.5.5'];
delete pid['PID.5']['PID.5.6'];
delete pid['PID.5']['PID.5.7'];
delete pid['PID.6']['PID.6.1'];
delete pid['PID.9']['PID.9.1'];
delete pid['PID.11']['PID.11.6'];
delete pid['PID.11']['PID.11.7'];
delete pid['PID.11']['PID.11.8'];
delete pid['PID.11']['PID.11.9'];
delete pid['PID.13']['PID.13.2'];
delete pid['PID.13']['PID.13.3'];
delete pid['PID.13']['PID.13.4'];
delete pid['PID.20']['PID.20.1'];
pid['PID.23']['PID.23.1'] = '';
(continued with very long PV1 & PV2 lists, both preceded with a for each statement)

2. Added this
if(msg['MSH']['MSH.9']['MSH.9.2'].toString() != 'A17')
to my PV1 & PV2 transformers.

Seems to work. Will move to Prod on Monday to find out for certain.
Reply With Quote