Announcement

Collapse

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

the createSegment function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • the createSegment function

    Hello everyone,

    does anyone know how to use the createSegmentAfter('segmentName', target) method? Can you please give a small example?

    Thank you very much!

    Svetlomir

    Post edited by: Svetlomir Kasabov, at: 05/11/2008 12:12

  • #2
    Re:the createSegment function

    Hi Svetlomir!

    I don't know if you still looking after that, but follow below an example:

    var obx = createSegment('OBX');
    var i = 1;

    while (result.next())
    {
    createSegmentAfter('OBR', tmp['OBX']);
    obx['OBX.1']['OBX.1.1'] = i;
    obx['OBX.2']['OBX.2.1'] = 'NM';
    obx['OBX.3']['OBX.3.1'] = '302789003';
    obx['OBX.3']['OBX.3.2'] = 'Glucose';
    obx['OBX.3']['OBX.3.3'] = 'SNOMED-CT';
    obx['OBX.4']['OBX.4.1'] = '';
    obx['OBX.5']['OBX.5.1'] = result.getFloat(20);
    obx['OBX.6']['OBX.6.1'] = '258813002';
    obx['OBX.6']['OBX.6.2'] = 'mmol/L';
    obx['OBX.6']['OBX.6.3'] = 'SNOMED-CT';
    obx['OBX.7']['OBX.7.1'] = '3-6';
    tmp['OBX'][i] = obx;

    i++;
    }

    Hope it helps.

    Cheers,

    Alexander

    Post edited by: Alexander, at: 05/14/2008 16:23

    Comment


    • #3
      Re:the createSegment function

      I could not make sense out of the createSegment or createSegmentAfter code, but I was able to "insert after" a segment by doing the following:
      Code:
      var FHSSendingApplication = msg['FHS']['FHS.3']['FHS.3.1'].toString();
      var FHSSendingFacility = msg['FHS']['FHS.4']['FHS.4.1'].toString();
      var zss = createSegment('ZSS');
      zss['ZSS.1']['ZSS.1.1'] = FHSSendingApplication;
      zss['ZSS.2']['ZSS.2.1'] = FHSSendingFacility;
      
      tmp=msg;
      
      var count = 0;
      for each (msh in tmp..MSH)
      {
      	tmp['MSH'][count]= tmp['MSH'][count]+zss; //createSegmentAfter('ZSS', tmp['MSH']);
      	count++;
      }

      Comment

      Working...
      X