Regsub problem

  • Creator
    Topic
  • #49777
    Rick Pritchett
    Participant

    I’m trying to use the following proc at the route level.

Viewing 7 reply threads
  • Author
    Replies
    • #63560
      Jim Kosloskey
      Participant

      Rickey,

      So if you get this proc running, I assume you intend to use it at the IB Tps or pre_xlate whatever.

      I think it will replace valid & with ‘and’ – won’t that corrput the HL/7 message as well?

      In other words if a field within the inbound message validly has a sub-component, I think when this proc is finished with the message, it will not have a valid sub-component.

      While most of the time most messages do not contain a sub-component, there is no assurance they could not.

      I know this does not fix your proc so a suggestion.

      Show us the error you are getting from the log.

      Thanks,

      Jim Kosloskey

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

    • #63561
      Charlie Bursell
      Participant

      & is  a back reference and even if it did not error it would not give you what you want.  & is not a special character and does not need to be escaped.  As a matter of fact, in the new regular expression engine if you escape a character that is not a special character it will give you an error.

      If you write it like:  regsub -all {&} $msg “and” msg  It will work.  I would probably write it like:  regsub -all — {&} $msg {and} msg  to avod any possibility of ambiguity.

      An even better and much faster solution would be:

      set msg [string map {& and} $msg]

    • #63562
      Gary Atkinson
      Participant

      Just an idea.  You could loop through all the segments except MSH.  That way you would not touch MSH:2.

    • #63563
      Rick Pritchett
      Participant

      to get the msh2 back to what i nedd i just manually do it in the xlate

    • #63564
      John Mercogliano
      Participant

      I’ve had to do the same thing.  Here is a code snippet of what I’ve done, to avoid changing the MSH:2

      Code:


      set msgHeader [string range $msg 0 8]
      set msgTail [string range $msg 9 end]
      set msgTail [string map {& /T/} $msgTail]
      append newmsg $msgHeader $msgTail
      msgset $mh $newmsg

      John Mercogliano
      Sentara Healthcare
      Hampton Roads, VA

    • #63565
      Rick Pritchett
      Participant

      ok it may not have been just the proc messing with things this is appearing in the testing tool when i try to run one of the messages through the xlate.

      IF data fetch produced multiple values.

      Fetch failure on ‘{IF data fetch produced multiple values.}’

    • #63566
      John Mercogliano
      Participant

      That is usually caused by the ampersand appearing in the field that is use in an IF statement.  When the If statement tries to read the subfield it thinks that there are multiple values being passed and errors.  So possible your code did not work as expected in removing the ampersand.

      John Mercogliano
      Sentara Healthcare
      Hampton Roads, VA

    • #63567
      Rick Pritchett
      Participant

      finally got a chance to use these suggestions and it works

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

Forum Statistics

Registered Users
5,125
Forums
28
Topics
9,294
Replies
34,439
Topic Tags
287
Empty Topic Tags
10