web stats
Mirth Community - View Single Post - How to exclude one msg type from transformer
View Single Post
  #1  
Old 03-29-2017, 05:19 AM
pmcnally pmcnally is offline
Mirth Newb
 
Join Date: Dec 2015
Location: Massachusetts
Posts: 9
pmcnally is on a distinguished road
Unhappy How to exclude one msg type from transformer

Hi all,

We are on Mirth 3.4.0.800. I have a java transformer that adds a ROL segment. On one message type, indicated by both/either MSH.9= A17 OR MSH.8= SWAPADMIN, there are multiple PID, PV1 & PV2 segments so I want to ignore the addition of the ROL on these. I wasn't sure where to add this w/o messing up the existing code.


var rolAlreadyCreated = false;

if(msg.DRG.length() > 0 && rolAlreadyCreated == false)
{
var rol = createSegmentAfter('ROL', msg.DRG);

rol['ROL.3.1'] = 'PP';
rol['ROL.4.1']['4.1.1'] = existingPV1['PV1.51']['PV1.51.1'];
rol['ROL.4.1']['4.1.2'] = existingPV1['PV1.51']['PV1.51.2'];
rol['ROL.4.1']['4.1.3'] = existingPV1['PV1.51']['PV1.51.3'];
rol['ROL.4.1']['4.1.4'] = existingPV1['PV1.51']['PV1.51.4'];

rolAlreadyCreated = true;
}

if(msg.GT1.length() > 0 && rolAlreadyCreated == false)
{
var rol = createSegmentBefore('ROL', msg.GT1);

rol['ROL.3.1'] = 'PP';
rol['ROL.4.1']['4.1.1'] = existingPV1['PV1.51']['PV1.51.1'];
rol['ROL.4.1']['4.1.2'] = existingPV1['PV1.51']['PV1.51.2'];
rol['ROL.4.1']['4.1.3'] = existingPV1['PV1.51']['PV1.51.3'];
rol['ROL.4.1']['4.1.4'] = existingPV1['PV1.51']['PV1.51.4'];

rolAlreadyCreated = true;
}
if(msg.OBX.length() > 0 && rolAlreadyCreated == false)
{
var rol = createSegmentAfter('ROL', msg.OBX);

rol['ROL.3.1'] = 'PP';
rol['ROL.4.1']['4.1.1'] = existingPV1['PV1.51']['PV1.51.1'];
rol['ROL.4.1']['4.1.2'] = existingPV1['PV1.51']['PV1.51.2'];
rol['ROL.4.1']['4.1.3'] = existingPV1['PV1.51']['PV1.51.3'];
rol['ROL.4.1']['4.1.4'] = existingPV1['PV1.51']['PV1.51.4'];

rolAlreadyCreated = true;
}

// only update when consult provider is present,
if (existingPV1['PV1.9'].length() > 0 && existingPV1['PV1.9']['PV1.9.1'].length() > 0) {
var newROL = createSegmentAfter('ROL', msg.ROL);
newROL['ROL.3.1'] = 'CP';
newROL['ROL.4.1']['4.1.1'] = existingPV1['PV1.9']['PV1.9.1'];
newROL['ROL.4.1']['4.1.2'] = existingPV1['PV1.9']['PV1.9.2'];
newROL['ROL.4.1']['4.1.3'] = existingPV1['PV1.9']['PV1.9.3'];
newROL['ROL.4.1']['4.1.4'] = existingPV1['PV1.9']['PV1.9.4'];
}

Basically I am looking for
If MSH.8 is equal to 'SWAPADMIN' skip all the ROL code that follows, else proceed.

Any help would be appreciated.
Thanks,
Patti
Reply With Quote