Need to Move PV1.7.0 into FT1.3

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Need to Move PV1.7.0 into FT1.3

  • Creator
    Topic
  • #53334
    Frank Urbanija
    Participant

      I need to move PV1.7.0 into FT1.3 if FT1.3 (field after first -)is blank FT1.3 is in the format of xx-yyyy-zzz and I need to move PV1.7 into the second value (yyyy) and only if yyyy is blank.

    Viewing 5 reply threads
    • Author
      Replies
      • #77308
        Levy Lazarre
        Participant

          Frank,

          A sample would be useful.

          What does the data look like when yyyy is blank? Is it xx–zzz or xx-zzz?

        • #77309
          Frank Urbanija
          Participant

            Levy Lazarre wrote:

            Frank,

            A sample would be useful.

            What does the data look like when yyyy is blank? Is it xx–zzz or xx-zzz?

            looks like xx–zzzzz so when populate with PV1.7 would have the 2nd number and look like xxx-yyyy-zzzzzz

          • #77310
            Scott Folley
            Participant

              How about you take PV1.7.1 and FT1.3 as the input to a copy statement in the translate and set FT1.3 as the output from that copy statement.  Then you can take [ lindex [ split [ lindex $xlateInVals 1 ] “-” ] 1 ] and see if it is blank.

              Code:


              set inval1 [ lindex $xlateInVals 0 ]
              set inval2 [ lindex $xlateInVals 1 ]
              set testValue [ lindex [ split $inval2 “-” ] 1 ]
              if { $testValue eq “” } {
                 set inval2 [ lreplace $inval2 1 1 $inval1 ]
              }

              set xlateOutVals $inval2

              I have not actually tried this code I just wrote it directly into this browser so I may have put in some syntax errors so though the concept should be right your mileage may vary.

              Good luck Frank!

            • #77311
              Levy Lazarre
              Participant

                Frank,

                I have tested the following code against your samples and it worked fine for me.

                Like Scott, I started with a COPY of PV1.7.1 and FT1.3 into FT1.3

                COPY

                SOURCE                                     DESTINATION

                ======                                    =========

                PV1.7.1                                       FT1.3

                FT1.3

                Pre-Tcl:

                                           

                Code:



                lassign $xlateInVals pv1_7_1 ft1_3

                # echo >>> pv1_7_1: $pv1_7_1
                # echo >>> ft1_3: $ft1_3

                # Check for the pattern “–” in FT1.3; that would indicate a missing part2
                # since FT1.3 should be part1-part2-part3

                if {[regexp — {–} $ft1_3]} {
                  # collect part1 and part3 of the string
                    regexp (\w+)–(\w+) $ft1_3 all part1 part3
                    # echo >>> part1: $part1
                    # echo >>> part3: $part3

                 # Build our output by concatenating the appropriate parts with dashes
                 # (Could also use a join command)
                 
                 # Always return xlateOutVals as a list

                  set xlateOutVals [list $part1-$pv1_7_1-$part3]

                } else {
                       # The string in FT1.3 came in complete. Nothing to do.
                         set xlateOutVals [list $ft1_3]
                }

                In the HL7 variant that I used (version 2.3), the default length of FT1.3 was only 10 characters. I had to increase the length to 20 in order to hold the string sent.

                I hope this helps.

              • #77312
                Frank Urbanija
                Participant

                  Levy,

                  It worked like a charm when I put through the testing tool.

                • #77313
                  Frank Urbanija
                  Participant

                    Levy,

                    THANK YOU!!!!!

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