Trouble with dispList apending new records

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Trouble with dispList apending new records

  • Creator
    Topic
  • #55256
    Johnny Anderson
    Participant

      CL v5.8.5  Sun, Solaris 10, HL7 v2.5.1.  XML to HL7.  Message ORU_R01.

      Want to read entire ip xml file, find and remove seg

    Viewing 6 reply threads
    • Author
      Replies
      • #84725
        David Barr
        Participant

          Your dispList can only have dispositions and message handles. You can’t put message contents directly in the dispList. I don’t quite understand what you’re trying to do, but instead of this:

           lappend dispList “CONTINUE $obr_end_tag”

          you could try this:

           msgappend $nmh $obr_end_tag

        • #84726
          David Barr
          Participant

            Or better yet, replace the else block with this:

            Code:

              } else {
                set nmh [msgcopy $mh]
                lappend dispList “CONTINUE $nmh”
                if {[string equal $tag_name “”]} {
                  set obr_end_tag “”
                  append nmsg $obr_end_tag
                }
                msgset $nmh $nmsg
              }

          • #84727
            Johnny Anderson
            Participant

              David, thanks for the help.

              This is what I want to do:  Use a tclproc placed at TPS Inbound Data.  Read in all records of the input and write same records to the output.  

              See input file and output file below.  I want to delete this record:

            • #84728
              Charlie Bursell
              Participant

                Am I missing something here.  Seems like a very simple problem made hard

                Why not simply

                       run {

                           # Get message

                           keylget args MSGID mh

                           set ibMsg [msgget $mh[

                           # Remove

                           regsub -line — {} $ibMsg {} ibMsg

                           # Insert after

                           regsub -line — {} $ibMsg {} ibMsg

                           # Get rid of extra LF

                           set ibMsg [string map

                  $ibMsg]

                             msgset $mh $ibMsg

                             return “{CONTINUE $mh}”

                         }

              • #84729
                Johnny Anderson
                Participant

                  Charlie, thanks for the help. I put in the new logic and ran a test.

                  I have 2 problems.

                  1. When the was deleted, the CRLF is still there.

                      I need CRLF deleted also.

                  2. When the was inserted, it was concatenated to the .

                      I need it to be a separate record following the .

                • #84730
                  Charlie Bursell
                  Participant

                    Sorry I did not test it in the proc.  I thought the string map command would take care of the extra line feed.  On Windows, in Tcl, CRLF is treated as simply LF.

                    I was not aware you wanted a LF prior to the added OBR.

                    In the code below, note that replacement value in second regsub in inside double quotes (“”) instead of braces ({}).  That is so Tcl will interpret the n as a LF

                    Try this.  Still pretty simple stuff  ðŸ˜€

                    run {

                               # Get message

                               keylget args MSGID mh

                               set ibMsg [msgget $mh]

                               # Remove and LF

                               regsub -line — {n} $ibMsg {} ibMsg

                               # Insert after include LF

                               regsub -line — {} $ibMsg “n” ibMsg

                               msgset $mh $ibMsg

                               return “{CONTINUE $mh}”

                           }

                  • #84731
                    Johnny Anderson
                    Participant

                      That did it.  Thanks Charlie.  I was out sick Monday and Tuesday this week.

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