Variable number of messages output from one message

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Variable number of messages output from one message

  • Creator
    Topic
  • #51264
    Donna Bailey
    Participant

      I have an ORU message that needs to be broken up by the dates in OBX-14.  This can cause a variable amount of messages to be output.  I am using a tclproc due to the fact that the OBX segments that need to go together are not grouped together.  I have my logic working to create the separate messages.  I just can’t figure out how to get the messages “returned” properly.  

      This is what I am doing at the end of the loop to produce the output:

      msgset mh $newmsg

      lappend dispList “CONTINUE $mh”

      I get a dispList of {CONTINUE message0} {CONTINUE message0} {CONTINUE message0} {CONTINUE message0} {CONTINUE message0}

      and then errors:

      returned bogus strMsgId ‘message0’ four times

      The only message that is returned is the last one.

      Any help would surely be appreciated.

      Thanks,

      Donna Ledgerwood

      Micro Star Inc.

      Donna Bailey
      Tele: 315-729-3805
      dbailey@microstar.health
      Micro Star Inc.

    Viewing 1 reply thread
    • Author
      Replies
      • #69452
        Jonathan Hamilton
        Participant

          You are overwritting each message, since you are writting them to the same message handle.  Do a message copy of the original message handle (mh), then msgset the copied handle.  In the end, you will likely KILL the original message handle.

          If you are working with a large source message delete the data before you copy so the copy is faster.

          # If large data, uncomment next line.

          # msgset $mh {}

          foreach … … {

             set nmh [msgcopy $mh]

             msgset $nmh $newmsg

             lappend dispList “CONTINUE $nmh”

          }

          lappend dispList “KILL $mh”

        • #69453
          Donna Bailey
          Participant

            Thank You so much!!!  I was hoping it was something simple like that!  Works like a charm now. 😀

            Donna Bailey
            Tele: 315-729-3805
            dbailey@microstar.health
            Micro Star Inc.

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