Keeping the & in OBX.5 while losing the ~

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Keeping the & in OBX.5 while losing the ~

  • Creator
    Topic
  • #52840
    Gordon Koch
    Participant

      Hello All,

          I have a problem where I am successfully removing the “~” from OBX.5, but the Xlate is also removing the & when present. Of course the & is being read as the sub field delimiter, but I want it present, or to convert it to “AND” since this the intent in the lab result. The CONCAT line is as follows:

      Source: ~1(0).1(0).1(%g1).OBX.00573(0)

                 1(0).2(0).1(%g1).OBX(0).00573(%f1)

      Destination: 1(0).1(0).1(%g1).OBX.00573(0)

      I understand the the engine is doing exactly what is being coded, but how do I keep the ampersands?

      When I add the following tcl fragment to the Pre Proc, nothing gets translated.

      set result [lindex $xlateInVals 0]

                    regsub -all {&} $result {AND} noamp

                    set xlateOutVals $noamp

      I do not know if this can be done by Xlate only, or I need to fix my tcl to work with this setup. Any help would be appreciated…

      Thank You

    Viewing 3 reply threads
    • Author
      Replies
      • #75630
        Daniel Lee
        Participant

          I don’t know if you can change the delimiters in the xlate.  From what I can see of your code, your xlate isn’t actually removing the ‘~’.  It’s combining repeating fields into one field therefore eliminating the need for the ‘~’ in your outbound message.  I know the result is the same, but the big difference is that I don’t think you have access to manipulate the delimiters within the xlate.

          You could probably do something similar with the &’s to what you’re doing with the ‘~’ and iterate over the subfields and combine them into one field.  If it were me, I’d prefer to do it in a tclproc before it gets to your xlate.

        • #75631
          Vince Angulo
          Participant

            I’m not sure if the xlate is the right place to work on delimiters either — maybe if you PATHCOPY the entire segment into a temp variable then try and remove them?

            But a pre-xlate proc is probably the cleaner solution – that’s what we do here.

            Good luck!

          • #75632
            Gene Salay
            Participant

              Would this work as a tcl frag?

              set resulta [lindex $xlateInVals 0]

              set resultb [lindex $xlateInVals 1]

              if {[string length $resultb]} {

              set resultb AND$resultb

              }

              set xlateOutVals

                If the inbound value contains an &, it’s treated as two fields, and xlateInVals 1 has content, so you replace the inbound & with an AND.

            • #75633
              Gordon Koch
              Participant

                Thanks to everyone for your replies. With this information and other help, I realize that this needs to be done outside of the Xlate and in a pre proc at the route position.

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