need help with either TCL proc or Translation

Clovertech Forums Cloverleaf need help with either TCL proc or Translation

  • Creator
    Topic
  • #122106
    michele
    Participant

      I’ve been asked to make this change in the OBX segment of an HL7 message:

      Change from this   OBX|||||https://ein.changehealthcare.com/viewer/encurl?mrn=M000001140\T\aa=DEFAULT\T\accession=A0000001021\T\os=DEFAULT

      To this                          OBX|||||https://ein.changehealthcare.com/viewer/encurl?mrn=M000001140&aa=DEFAULT&accession=A0000001021&os=DEFAULT

      Where I need to remove the \T\ everywhere in this URL string in segment 5 and substitute an & in that place.

       

      I’m thinking I need a TCL Proc that will split the URL string to the \T\ characters, substitute the & in the 3 places where it needs to be, then concatenate the string back together.    Which is the best way to do this, a TCL proc or Xlate?      Does anyone have an example of a TCL proc or Xlate that shows/explains how to do that?     I’m new to Cloverleaf and TCL so any help would be greatly appreciated!

       

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

          You do not indicate what release of Cloverleaf but if 6.0 or later, check out the Xlate STRING Action Map command I think that should do it without using Tcl. If you are not familiar with the STRING Action, email me and I will send you a packet with a presentation that explains all of the STRING Action Functions; some additional STRING Actions I created; an exercise Xlate for all of the STRING Actions (including the ones I have written/modified); and a test file to use with the Xlate in the Testing tool.

          If you decide to explore the STRING Action Map Function, realize the backslashes (\) are Tcl escape characters and you will need to escape them something like this \\T\\ in your map.

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

          • #122108
            Jim Kosloskey
            Participant

              Also understand the & has special meaning as an HL/7 separator so the receiving system (depending on how it parses the message) may treat that as a separator rather than data.

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

          • #122109
            Tammy Hale
            Participant

              I used this in my xlate

              set spmap {\\T\\ &}
              set xlateOutVals [string map $spmap $xlateInVals]

            • #122111
              michele
              Participant

                Hi Tammy,

                I’m still struggling with how to make this translation work.  Can you tell me or show me how/where you used that string map code in your translation?

                Thanks,

                Michele

              • #122114
                Jason Russell
                Participant

                  What version of Cloverleaf are you using?

                • #122115
                  michele
                  Participant

                    I was able to get this translation working using the String Action Map function (with help from Jim Koslosky).    I’m attaching a screenshot of the code in the translation.   This translation replaces \T\ in a string with &.    This is in an OBX segment.

                    This is the original segment:

                    2(0).1(0).1(0).0(0).OBX(0) : >||RP|||https://ein.changehealthcare.com/viewer/PatientPortfolio?mrn=M000001160\T\aa=DEFAULT\T\accession=A0000001180\T\os=DEFAULT<

                    This is the segment after the translation was run in the testing tool:

                    2(0).1(0).1(0).0(0).OBX(0) : >||RP|||https://ein.changehealthcare.com/viewer/PatientPortfolio?mrn=M000001160&aa=DEFAULT&accession=A0000001180&os=DEFAULT<

                     

                    Thank you to everyone who responded to this post!   All your help was most appreciated.

                    Attachments:
                    You must be logged in to view attached files.
                Viewing 4 reply threads
                • You must be logged in to reply to this topic.