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

Detecting empty segments

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

  • Detecting empty segments

    I'm parsing through an HL7 message containing multiple OBX segments. In some cases, the first OBX segment will only have an ID, but no other fields filled in. All of the other OBX segments will. What I can't seem to figure out is how to continue with the next OBX segment if a field is empty. Here is a snippet:

    for each (obx in msg..OBX)
    {
    code = obx['OBX.3']['OBX.3.1'].text();
    logger.info('Code was ' + code);

    // move to next segment if no result
    // doesn't work
    if (obx['OBX.5']['OBX.5.1'] == null)
    {
    continue;
    }

    // no joy
    if (obx['OBX.5']['OBX.5.1'].text() == null)
    {
    continue;
    }

    // no luck here either
    if (obx['OBX.5']['OBX.5.1'].text() == "")
    {
    continue;
    }
    }

    How can I move to the next OBX segment if a specific field in the current OBX segment is empty?

    Thanks,
    Vince

  • #2
    Reetecting empty segments

    http://www.mirthproject.org/index.ph...2&catid=2#3262

    Comment


    • #3
      Reetecting empty segments

      Thanks! That helped point me in the right direction. This appears to work:

      for each (obx in msg..OBX)
      {

      code = obx['OBX.3']['OBX.3.1'].text();

      logger.info('Code was ' + code);



      // move to next segment if no result

      if (obx['OBX.5']['OBX.5.1'].text().length() <= 0)
      {
      logger.info('Continuing, no result');
      continue;
      }


      }

      The more I work with this project, the more impressed I am. Great work guys.

      Vince

      Comment


      • #4
        Reetecting empty segments

        Glad you got it working!

        The more I work with this project, the more impressed I am. Great work guys.
        Same here! If you have followed the phenomenal work they have been doing from 1.0 to the current release (the change requests, release, support, and most important of all the "price" ), you'll appreciate the dedication, effort, and the fantastic work WebReach team has been doing! Excellent work guys!

        Comment

        Working...
        X