keeping back slash in OBX.5

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf keeping back slash in OBX.5

  • Creator
    Topic
  • #51652
    Doug Lundin
    Participant

      This is the string that comes in OBX.5

      E\EendoEreportsE303723Ever1EProcedureNote.pdf

      We need to only use part of the string from position 20 to the end.

      A pre proc was created:

      set xlateOutVals [string range $xlateInVals 20 end]

      The results aren’t correct becuase tcl is changing  the to a hex value.

      We tried string map but that didn’t seem to help

      set tv [string map { \} $tval]

      The result we are looking for is: E303723Ever1EProcedureNote.pdf

    Viewing 8 reply threads
    • Author
      Replies
      • #71117
        Jim Kosloskey
        Participant

          Doug,

          xlateInVals and xlateOutVals are LISTS.

          Try something like this:

          lreplace xlateOutvals 0 0 [string range [lindex $xlateInVals 0] 20 end]

          The lreplace replaces the first element of the list xlateOutVals.

          The lindex gets the first element of the list xlateInVals

          The string range you already have.

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

        • #71118
          Tom Rioux
          Participant

            Doug,

            As Jim stated, you will have to treat xlateInVals and xlateOutVals as list.  Also, you will need to escape the backslashes to get them to populate correctly in your Xlate.  Try this below.  It worked for me.  “PDF” and “NPDF” are variables I used, feel free to use whatever suits your needs.

            set pdf [string range [lindex $xlateInVals 0] 20 end]

            set npdf [string map {\ \\} $pdf]

            set xlateOutVals $npdf

            Hope this helps…

            Tom Rioux

          • #71119
            Jim Kosloskey
            Participant

              Tom and Doug,

              If you use the lreplace or some other list command to populate xlateOutVals there is no need to play with the .

              Here is the solution in hcitcl:

              hcitcl>lreplace xlateOutVals 0 0 [string range [lindex $xlateInVals 0] 20 end]

              {E303723EverEProcedureNote.pdf}

              Note there does not seem to be any issue with the slashes when using lreplace.

              I don’t think there is any need for the string map if list commands are used on both the in and out.

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

            • #71120
              Doug Lundin
              Participant

                thanks guys got it to work.  Appreciate all the help

              • #71121
                Tom Rioux
                Participant

                  Jim,

                  I copied your solution into an xlate, and couldn’t get it to work for me.  Don’t know what could be happening.

                  Thanks though…Tom

                • #71122
                  Jim Kosloskey
                  Participant

                    Tom,

                    Interesting…

                    I will try it in an Xlate and see what I can see.

                    As you can see I just did my testing in hcitcl.

                    I will let you know what I find out.

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

                  • #71123
                    Jim Kosloskey
                    Participant

                      Tom,

                      I finally got time to set this up in an Xlate.

                      Here is the Tcl line I had in a COPY of 1(0).1(0).1(0).OBX(0).#5(0) to 1(0).1(0).1(0).OBX(0).#5(0):

                      set xlateOutVals [lreplace $xlateOutVals 0 0 [string range [lindex $xlateInVals 0] 20 end]

                      The only thing I see different here is the addition of the ‘set xlateOutVals’ but I assume you had that.

                      Here is the result in the Xlate Testing Tool:

                      TEST XLTECHO v1.1: *** START *********************************************************************************************

                      TEST XLTECHO v1.1: xlateInList >@xltecho_debug {=Inbound OBX-5…} 1(0).1(0).1(0).OBX(0).#5(0)<

                      TEST XLTECHO v1.1: xlateInVals >Y {Inbound OBX-5…} {E\EendoEreportsE303723EverEProcedureNote.pdf}<

                      TEST XLTECHO v1.1: There are >3< elements in the Source list.

                      TEST XLTECHO v1.1:


                      Start


                      TEST XLTECHO v1.1: Source element >0@xltecho_debugY<.

                      TEST XLTECHO v1.1: Source element >1LITERALInbound OBX-5…<.

                      TEST XLTECHO v1.1: Source element >21(0).1(0).1(0).OBX(0).#5(0)E\EendoEreportsE303723EverEProcedureNote.pdf<.

                      TEST XLTECHO v1.1:


                      End


                      TEST XLTECHO v1.1: *** START *********************************************************************************************

                      TEST XLTECHO v1.1: xlateInList >@xltecho_debug {=Outbound OBX-5 After trimming…} ~1(0).1(0).1(0).OBX(0).#5(0)<

                      TEST XLTECHO v1.1: xlateInVals >Y {Outbound OBX-5 After trimming…} {E303723EverEProcedureNote.pdf}<

                      TEST XLTECHO v1.1: There are >3< elements in the Source list.

                      TEST XLTECHO v1.1:


                      Start


                      TEST XLTECHO v1.1: Source element >0@xltecho_debugY<.

                      TEST XLTECHO v1.1: Source element >1LITERALOutbound OBX-5 After trimming…<.

                      TEST XLTECHO v1.1: Source element >2~1(0).1(0).1(0).OBX(0).#5(0)E303723EverEProcedureNote.pdf<.

                      TEST XLTECHO v1.1:


                      End


                      MESSAGE 1

                      0(0).MSH(0)  :  >|^~&|LAB|SCC|CLOVERLEAF|MDACC|20100323115641||ORU^R01|00278280|D|2.4<

                      1(0).0(0).0(0).PID(0)  :  >|||0000002||TEST^ALOHA||19750405|F||U||||||||000000000004<

                      1(0).0(0).0(0).NTE(0)  :  >|1||?EDTA Clumper 02/23/2010  09:50<

                      1(0).0(0).1(0).PV1(0)  :  >||I|00006^101^A||000000000004||00020^HUARINGA^ARMANDO^J^^^^^^^^^MDACC~F13939^^^^^^^^^^^^UPIN~1821110271^^^^^^^^^^^^NPI||||||||||~^^^^^^^^^^^^UPIN~^^^^^^^^^^^^NPI|I<

                      1(0).1(0).0(0).ORC(0)  :  >|RE|152300001:188|188|152300001|||^^^20100323^^R||201003230741|SCC|||00006^B4<

                      1(0).1(0).0(0).OBR(0)  :  >|1|152300001:188|188|Y1167^Metanephrines, Fractionated, Urine^^Y1167|||201003230600|||SCC||||201003230741||00020^HUARINGA^ARMANDO^J^^^^^^^^^MDACC~F13939^^^^^^^^^^^^UPIN~1821110271^^^^^^^^^^^^NPI||||||||REF01|P|||||||SCC||SCC<

                      1(0).1(0).0(0).NTE(0)  :  >|1||This is an order comment.<

                      1(0).1(0).1(0).OBX(0)  :  >|1|ST|Y1171^Collection Duration, Urine^^ ||E303723EverEProcedureNote.pdf||||||F|||201003230741||SCC|201003230743<

                      I put the OBX-5 field in question in Bold in the mesage.

                      Seems to work fine for me.

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

                    • #71124
                      Tom Rioux
                      Participant

                        Weird….because when I put that into my xlate, I got the same kind of output that Doug was describing.

                        At least he has it working now……Thanks Jim!

                      • #71125
                        Jim Kosloskey
                        Participant

                          Tom,

                          Maybe its a release level thing. We are on 5.6.

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

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