Changing T back to & – Part 2

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Changing T back to & – Part 2

  • Creator
    Topic
  • #48826
    garry r fisher
    Participant

      Hi,

      Some assistance would be appreciated please.

      I have the following input – ’73 LEEDS T BRADFORD’

      Which I want to be ’73 LEEDS & BRADFORD’

      I have the following xlate procedure:

         set tmp [lindex $xlateInVals 0]

         regsub -all {\T\} $tmp {&} tmp

         set xlateOutVals

        I know it can be done simpler than this but I was echoing the output to check it at each step.

        If I put this as a pre proc I get ’73’ which is what I expect as the HL7 parser will truncate it.

        If I put it as a post proc I get ’73 LEEDS T BRADFORD’

        Why is the post proc not doing the translate correctly – What am I doing wrong?

        Regards

        Garry

    Viewing 3 reply threads
    • Author
      Replies
      • #59824
        Greg Eriksen
        Participant

          I’m surely not an expert on Cloverleaf, but since no one else has responded yet, I’ll offer my 2 cents worth.

          First a point of confusion.  You say that when you run your code as a pre proc you get the output you expect of just ’73’.  But it seems like you should actually be populating the outbound field with ’73 LEEDS & BRADFORD’, and then maybe the receiving system would truncate it to just the first subcomponent of ’73 LEEDS ‘, but not just ’73’.

          As for your main question, I think that is just the way that Cloverleaf works.  I frankly don’t understand why they even have an xlate post proc, but I believe that it’s pointless to put any code there and that the only way you can alter the content of what gets copied to the output record is to use the pre proc.  I hope someone will correct me if I am wrong here.  But is there any reason you felt you needed to use the post proc instead of the pre proc?

        • #59825
          Charlie Bursell
          Participant

            set xlateOutVals

              ]

            1. #59826
              garry r fisher
              Participant

                Hi,

                Greg – Sorry for the confusion. The inbound data is HL7, outbound its a fixed length record. I thought the HL7 parser would work on the xlate splitting the record at the &.

                I’ve never got post proc to work either but I tried a number of experiments before wrote this and the text is an abbreviated version of my findings.

                Charlie – Thanks. You don’t say pre or post but I’ll try them both.

                Regards

                Garry

              • #59827
                garry r fisher
                Participant

                  Arghhh!! Got caught out by lists in xlates 🙁

                  G

                  Charlie – Your solution works – thanks

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