Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Multiple IN1 Segs with Optional IN2 Segs - Part 2

  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple IN1 Segs with Optional IN2 Segs - Part 2

    Well, I've done a bunch of javascript experimenting on this topic and have an example for folks to look at (if you're interested, of course). The script mostly works but it's still not putting the right IN2 segment with it's "parent" IN1 segment when each IN1 does not have a corresponding IN2.

    First, here's what the IN1/IN2 inbound message looks like:

    IN1 (parent1)
    IN1 (parent2)
    IN2 (goes with parent2)
    IN1 (parent 3)
    IN2 (goes with parent 3)

    The resultant IN1/IN2 output looks like the following:

    IN1 (parent1)
    IN2 (goes with parent2)
    IN1 (parent2)
    IN2 (goes with parent 3)
    IN1 (parent 3)

    Here's the code
    var i = 0;
    var j = 0;
    for each (in1 in msg..IN1)
        logger.error('i = ' + i + ' j = ' + j);
        logger.error('Starting IN1: ' + i);
        var in1 = createSegment('IN1');
        in1['IN1.1'] = msg['IN1'][i]['IN1.1'];
        in1['IN1.2'] = msg['IN1'][i]['IN1.2'];
        in1['IN1.3'] = msg['IN1'][i]['IN1.3'];
        in1['IN1.4'] = msg['IN1'][i]['IN1.4'];
        in1['IN1.5'] = msg['IN1'][i]['IN1.5'];
        in1['IN1.6'] = msg['IN1'][i]['IN1.6'];
        in1['IN1.7'] = msg['IN1'][i]['IN1.7'];
        in1['IN1.8'] = msg['IN1'][i]['IN1.8'];
        in1['IN1.9'] = msg['IN1'][i]['IN1.9'];
        in1['IN1.10'] = msg['IN1'][i]['IN1.10'];
        in1['IN1.11'] = msg['IN1'][i]['IN1.11'];
        in1['IN1.12'] = msg['IN1'][i]['IN1.12'];
        in1['IN1.13'] = msg['IN1'][i]['IN1.13'];
        in1['IN1.14'] = msg['IN1'][i]['IN1.14'];
        in1['IN1.15'] = msg['IN1'][i]['IN1.15'];
        in1['IN1.16'] = msg['IN1'][i]['IN1.16'];
        in1['IN1.17'] = msg['IN1'][i]['IN1.17'];
        in1['IN1.18'] = msg['IN1'][i]['IN1.18'];
        in1['IN1.19'] = msg['IN1'][i]['IN1.19'];
        in1['IN1.20'] = msg['IN1'][i]['IN1.20'];
        in1['IN1.21'] = msg['IN1'][i]['IN1.21'];
        in1['IN1.22'] = msg['IN1'][i]['IN1.22'];
        in1['IN1.23'] = msg['IN1'][i]['IN1.23'];
        in1['IN1.24'] = msg['IN1'][i]['IN1.24'];
        in1['IN1.25'] = msg['IN1'][i]['IN1.25'];
        in1['IN1.26'] = msg['IN1'][i]['IN1.26'];
        in1['IN1.27'] = msg['IN1'][i]['IN1.27'];
        in1['IN1.28'] = msg['IN1'][i]['IN1.28'];
        in1['IN1.29'] = msg['IN1'][i]['IN1.29'];
        in1['IN1.30'] = msg['IN1'][i]['IN1.30'];
        in1['IN1.31'] = msg['IN1'][i]['IN1.31'];
        in1['IN1.32'] = msg['IN1'][i]['IN1.32'];
        in1['IN1.33'] = msg['IN1'][i]['IN1.33'];
        in1['IN1.34'] = msg['IN1'][i]['IN1.34'];
        in1['IN1.35'] = msg['IN1'][i]['IN1.35'];
        in1['IN1.36'] = msg['IN1'][i]['IN1.36'];
        in1['IN1.37'] = msg['IN1'][i]['IN1.37'];
        in1['IN1.38'] = msg['IN1'][i]['IN1.38'];
        in1['IN1.39'] = msg['IN1'][i]['IN1.39'];
        in1['IN1.40'] = msg['IN1'][i]['IN1.40'];
        in1['IN1.41'] = msg['IN1'][i]['IN1.41'];
        in1['IN1.42'] = msg['IN1'][i]['IN1.42'];
        in1['IN1.43'] = msg['IN1'][i]['IN1.43'];
        in1['IN1.44'] = msg['IN1'][i]['IN1.44'];
        in1['IN1.45'] = msg['IN1'][i]['IN1.45'];
        in1['IN1.46'] = msg['IN1'][i]['IN1.46'];
        in1['IN1.47'] = msg['IN1'][i]['IN1.47'];
        in1['IN1.48'] = msg['IN1'][i]['IN1.48'];
        in1['IN1.49'] = msg['IN1'][i]['IN1.49'];
        tmp['IN1'][i] = in1;
        logger.error('Done with IN1: ' + i);
    //  Now Do the IN2s ....
        var in2 = createSegment('IN2');
        createSegmentAfter('IN1', tmp['IN2'][j]);
        logger.error('Trying IN2: ' + j);
    	in2['IN2.1']['IN2.1.1'] = "HELLo IN2: " + (j);
    	in2['IN2.2'] = msg['IN2'][i-1]['IN2.2'];
    	in2['IN2.6'] = msg['IN2'][i-1]['IN2.6'];
    	tmp['IN2'][j] = in2;
    	logger.error('Did IN2: ' + j);
    	delete tmp['IN2'][j];
    	logger.error('Oops.  Deleted IN2: ' + j);
    I'm assuming that there is indeed a way to get this to work in Mirth. I'm sure my code is faulty in some way, or I'm not thinking through the "problem" correctly.

    Our use of Mirth really depends on us being able to handle this sort of situation, not only for the IN1/IN2 situation but other parent/child segment combinations as well. It's easy with egate (4.5.3) and I'd love to be able to demo this functionality in Mirth to our management team! Any pointers would be MOST appreciated.

    Bob D.
    Bob Dilworth
    University of Toledo Medical Center
    Toledo, Ohio