Set format to concat multOBX segments into one segment

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Set format to concat multOBX segments into one segment

  • Creator
    Topic
  • #53472
    Matthew Laskin
    Participant

      The following message is translated to a destination that will intepret OBX segments with a value type of TX as a text report.  The source for the message is sending a mixture of text and discrete results, which I’m imagining will be easier to translate entirely into text.  Below is an example of one line an OBX segment.

      Code:

      OBX|5|CE|^^^CFZ^CEFAZOLIN^LB||S^S^REACTION~<=2^<=2^MIC|||S|||F|||201203121124|ML^MAIN LAB^L|

      I’ve created the following CONCAT action in my xlate.

      SOURCE

      Code:

      1(0).1(%g2).1(%g3).OBX(0).#3(0).[4]
      =+
      1(0).1(%g2).1(%g3).OBX(0).#5(1).[0]
      =+
      1(0).1(%g2).1(%g3).OBX(0).#5(0).[0]

      DESTINATION

      Code:

      1(0).1(%g2).1(%g3).OBX(0).#3(0).[1]

      I’ve included the following pre-proc TCL snippet in the action.

      Code:


      set output [split $xlateInVals +]
      set xlateOutVals “[format “%-40s %-20s %-20s” [lindex $output 0] [lindex $output 1] [lindex $output 2]]”
      echo $xlateOutVals

      The echo shows that my xlateOutVals are nicely spaced the way I’d want them to be, but in the testing tool’s output, the new segment has stripped away the space characters.

      Code:

      ECHO
      CEFAZOLIN                                 <=2                  S   HL7 1(0).1(2).1(4).OBX(0)  :  >|5|TX|CFZ^CEFAZOLIN<=2S<

      Am I missing something, or am I trying to do something that violates the HL7 standard enforced by Cloverleaf.

    Viewing 2 reply threads
    • Author
      Replies
      • #77794
        Elisha Gould
        Participant

          Try using list for the output value. ie

          set xlateOutVals “

            [lindex $output 1] [lindex $output 2]]]”

            This adds {} around the text. It may be taking each value as a member of a list and joining them. This will make it a single item.

            Note the {} will not be present in the hl7 text.

          1. #77795
            Matthew Laskin
            Participant

              Thank you!  That worked nicely.

            • #77796
              Matthew Laskin
              Participant

                Just in case anyone uses this thread as a reference in the future, there’s several mistakes in the above that needed to be worked out.

                The most substantial being that the inbound concat fields did not need to be split into a list, since they will come in as a list.  Removed the “=+” from the xlate and the “[split $xlateInVals +]” from the tcl.

                😳

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