Splits the field on HL7

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Splits the field on HL7

  • Creator
    Topic
  • #52398
    Hyo-Chan Lee
    Participant

      I tried to split  one filed into two values from the HL7 message.

      FT1|||23BHC||||

      FT1|||1LYC|||

      FT1|||102CYN|||

      Spilt to 23 and BHC and 23 should put into the field 13 and BHC into the field 16 on FT1 segment.

          same manner with   1 and LYC                

          and         102 and CYN

      Can I implement this with a XLT?

    Viewing 4 reply threads
    • Author
      Replies
      • #74052
        Jim Kosloskey
        Participant

          You will need some Tcl within the Xlate.

          You can use the string range Tcl comand.

          Have you written xltp type Tcl code (Xlate invoked Tcl)?

          Do you know how to find help on the string Tcl command?

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

        • #74053
          Hyo-Chan Lee
          Participant

            I took a TCL class a long time ago but I’ve not been using it yet.

            Can you help me to implement my project?

            Thanks,  HCL

          • #74054
            Jim Kosloskey
            Participant

              Upon closer inspection of your problem I see that the field that needs tyo be parsed can be led with a variable nnumber of numeric characters followed by some number of non-numeric characters.

              You still will need Tcl but the string range command (at least by itself) will not do the trick.

              It is possible a regexp could do the job – however I am not real good with regexp or regsub and I don’t have nything in hand that addresses this issue.

              Perhaps someone else on the forum can assist.

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

            • #74055
              Levy Lazarre
              Participant

                Hyo-Chan,

                What you need to do is COPY the FT1.3 field to two different variables, say @field13 and @field16. While performing the COPYs, you can use a Pre Tcl to extract the two values that you need and save them to the variables.

                The first COPY captures the numeric portion of FT1.3 and saves it to the variable named @field13. Please note that the path for the FT1 field is for illustration only; use the appropriate path for your HL7 variant.

                COPY

                Source: 0(0).FT1(0).#3         Destination: @field13

                Pre Tcl:

                    set mystring [lindex $xlateInVals 0]

                    regexp {^d+} $mystring field13

                    set xlateOutVals

                  (After this, @field13 would contain 23 for example)

                  The second COPY captures the string portion of FT1.3 and saves it to the variable named @field16

                  COPY

                  Source: 0(0).FT1(0).#3         Destination: @field16

                  Pre Tcl:

                      set mystring [lindex $xlateInVals 0]

                      regexp {[A-Za-z]+$} $mystring field16

                      set xlateOutVals

                  (After this, @field16 would contain BHC for example)

                     

                  Now that you have the values for the two variables, it’s just a matter of

                  copying them to the two destinations that you want (FT1.13 and FT1.16). Again, use the appropriate paths for your HL7 variant.

                  COPY

                  Source: @field13               Destination: 0(0).FT1(0).#13

                  COPY

                  Source: @field16               Destination: 0(0).FT1(0).#16

                  Finally, it appears that you have multiple FT1 segments in the message. Most likely, all of this would be done inside an ITERATE. Therefore your input side will probably be like 0(0).FT1(%s1).etc

                  I hope this helps.

              • #74056
                Hyo-Chan Lee
                Participant

                  Thanks for helping me both of you.

                  I’ll try to follow Levy’s insruction and let you know.

                  Thanks,

                  Hyo-Chan

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