Clear Outbound Message Prior to Iterate when splitting MSG

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Clear Outbound Message Prior to Iterate when splitting MSG

  • Creator
    Topic
  • #54333
    Weston Olmstead
    Participant

      I am splitting a single Laboratory message with OBR/OBX sets into multiple messages with one OBR/OBX set per message, using the supress/continue method in an xLate.  What I’m finding is that if my previous set iteration contained more OBX sets than my current iteration, I still have some sets left over.

      Is there a way to “clear” an outbound message structure between Iterates, to resolve situations like this? Any suggestions on how to handle this?

      For example:

      MSH

      PID

      OBR|1|

      OBX|1||||FIRST SET RESULT 1

      OBX|2||||FIRST SET RESULT 2

      OBX|3||||FIRST SET RESULT 3

      OBR|2|

      OBX|1||||SECOND SET RESULT 1

      Results in the following two messages:

      MSH

      PID

      OBR|1|

      OBX|1||||FIRST SET RESULT 1

      OBX|2||||FIRST SET RESULT 2

      OBX|3||||FIRST SET RESULT 3

      MSH

      PID

      OBR|2|

      OBX|1||||SECOND SET RESULT 1

      OBX|2||||FIRST SET RESULT 2

      OBX|3||||FIRST SET RESULT 3

    Viewing 2 reply threads
    • Author
      Replies
      • #81042
        Jim Kosloskey
        Participant

          Weston,

          What I do is AFTER the CONTINUE in the OBX ITERATE within the OBR ITERATE I do another ITERATE on the OBX and inside that ITERATE I PATHCOPY or individual field COPY @null to the outbound.

          So effectively after Continuing the message with the set of OBXs I null them out preparing them for the next set of OBXs inside the next OBR Group.

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #81043
          Robert Kersemakers
          Participant

            Another option would be to first send out the messages with only 1 OBX, then all the messages with 2 OBXs etc.

            For this you need to go through all OBRs, count the number of OBXs (or the maximum index of OBX) and store this in a list, together with the index of the OBR. So in your case I would have a list like this: {{0 2} {1 0}}.

            Sort this list on the second element so you will get {{1 0} {0 2}}. Then go through this list and use the first element as the index of the OBR/OBX you need to send out.

            I did this once as I needed to split up an ORM message anyway based on very different criteria (certain labcodes needed to be collected) so this came in handy.

            Be aware though that if your OBR/OBX has other segments in it (like NTEs), then you really need to remove/clear these, in the way Jim explained.

            Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

          • #81044
            Weston Olmstead
            Participant

              Jim / Robert,

              Thank you both for the great ideas. I did end up clearing these out in the manner that Jim suggested, because there are other nested NTE segments in these results.

              Thanks again!

          Viewing 2 reply threads
          • The forum ‘Cloverleaf’ is closed to new topics and replies.