Need Help with Concatinating Fields

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Need Help with Concatinating Fields

  • Creator
    Topic
  • #52718
    Greg Tataryn
    Participant

      We are sending lab results from our hospital lab system to our physician practice EHR. On microbiology results, Novius Lab will send an OBX segment that could end at field 5 followed by one or more ADD segments. If there is only one ADD segment. ADD-1 is always a continuation of the text for the preceding OBX-5. If there is only on ADD segment the rest of the ADD will be the rest of the OBX, if there is more than one then all but the last ADD will have just the one field then the last one will be the full segment.

      Our EHR system cannot process the ADD segments so I am having to concatinate all the ADD-1 fields with OBX-5 then take the rest of the last ADD segment and move it to the appropriate OBX fields. I have it working great if there is only one ADD segment but if there is more than one I am completely stuck on how to handle this. I am open to any help or suggestions. Since I am already using a XLT file I would prefer to keep using it rather than using TCL code.

    Viewing 1 reply thread
    • Author
      Replies
      • #75268
        Jim Kosloskey
        Participant

          Greg,

          I am assuming the ADD segment is defined as repeating in your inbound variant.

          You can use an ITERATE to work through the segment repetitions.

          Are you comfortable with ITERATE?

          Anyway, one challenge is how to determine you have the last of the ADD segments. One way to do that is if there is a field within the ADD segment that is only populated with the last ADD segment you can use an IF to check to see if that field for the current repetition is equal to @null. If it is then this is not the last ADD segment.

          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

        • #75269
          Greg Tataryn
          Participant

            Jim Kosloskey wrote:

            Greg,

            I am assuming the ADD segment is defined as repeating in your inbound variant.

            You can use an ITERATE to work through the segment repetitions.

            Are you comfortable with ITERATE?

            Anyway, one challenge is how to determine you have the last of the ADD segments. One way to do that is if there is a field within the ADD segment that is only populated with the last ADD segment you can use an IF to check to see if that field for the current repetition is equal to @null. If it is then this is not the last ADD segment.

            I actually had an AH-HA moment just after I posted this and tried the iterate. I got an error when I tested it. Here is how the ORU is defined

            MSH

            PID

            ORC

            {

             OBR

             {

               OBX

               [{NTE}]

               [{ADD}]

             }

            }

            So to get to the ADD it is a tripple nested Iterate and the error I got was “Unable to get iteration basis address ‘1(%g1).1(%g2).ADD’.” Since it is just test data I can provide a sample message if needed by email.

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