replacing ~ with br

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf replacing ~ with br

  • Creator
    Topic
  • #51535
    Beth Palmateer
    Participant

      All of the postings I could find on replacing characters was to replace .br with ~.  I need to do just the opposite: replace ~ with br in OBX-5.  We are 5.5 Rev 1 on AIX 5.3.

      The sending vendor is sending an ORU for transcription reports with all data in one OBX-5 separated by a ~ to seperate the fields into 80 character lines.  The receiving vendor is saying that he needs br in order to break the lines in his report display.

      I have the following code in an xlate that works with a : as the character to replace:

      { { OP ITERATE }

         { BASIS 1(0).1(0).1(0).OBX.#5 }

         { VAR %f1 }

         { TYPE field }

         { BODY {

             { { OP COPY }

                 { ERR 0 }

                 { PRE {

                     set var [string map

        [lindex $xlateInVals 0 ]]

                       set xlateOutVals

                   }}

                   { IN 1(0).1(0).1(0).OBX.#5(%f1) }

                   { OUT 1(0).1(0).1(0).OBX.#5(%f1) }

               }

           }}

        This will replace every : throughout the field with br.  But whenever I try to replace the : with ~, it doesn’t seem to see that character.  I’ve tried everything I can think of to tell the code to recognize ~ as a delimiter to be replaced, but can’t get it figured out.  I’m sure it is something simple but I’ve been working on this for 3 days now and can’t see anything straight any more!  Can someone help?

        (Disclaimer: I’m not very tcl literate!)

        Beth Palmateer

        Salina Regional Health Center

    Viewing 2 reply threads
    • Author
      Replies
      • #70692
        Anonymous
        Participant

          Try this.

          set var [string map {“:” “\br\”} [lindex $xlateInVals 0 ]]

        • #70693
          Jim Kosloskey
          Participant

            Beth,

            This could also be done entirely within the Xlate without Tcl if I understand the issue.

            The OBX-5 field as presented by the sending system is a repeating field (that is what the ~ means).

            ITERATE over the field.

            Inside that ITERATE check for the first occurrence of the repetition (if using %f1 as a counter for example, check $%f1 eq =0).

            If it is the first repetition:

              COPY the OBX-5(%f1) to the Outbound OBX-5(0) (Note the zero in the destination repetition.

             ELSE

               CONCAT  the outbound OBX-5(0), =.br, and the inbound OBX-5(%f1) in the Source side and OBX-5(0) in the Destination side.

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

          • #70694
            Beth Palmateer
            Participant

              John, I had tried your suggestion.  The : worked fine but when I tried to substitute ~ for : it did not work.

              Jim – my xlate Hero!  Your suggestion does exactly what I need.  Thanks!

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