Create multible OBX-5 based on \.br\ in the original message

Clovertech Forums Cloverleaf Create multible OBX-5 based on \.br\ in the original message

  • Creator
    Topic
  • #117640
    Mike Campbell
    Participant

      We have a client that is requesting that we create multiple OBX-5 segments in place of sending one long one to their engine.  We have a tcl script that will replace the \.br\ in the message with either a space or ~ but they aren’t happy with it.  Suppose something like loop through using the index of the \.br\ and create a new OBX-5 message?  Anyone have any ideas or examples?

      Thanks.

    Viewing 2 reply threads
    • Author
      Replies
      • #117641
        Debbie Davis
        Participant

          We have a tclproc we use for this – creating new obx based on the ~.  I’d be happy to email it to you.

        • #117644
          Jim Kosloskey
          Participant

            Undoubtedly each line terminated by \.br\ in the OBX-5 contains spaces so adding another space does not properly terminate each line otherwise once the space were in place (in a temp variable for example) you could treat the data element as a list. If on Cloverleaf 19.1 the ‘User’ repetition type in an ITERATE would allow you to work through the list repetitions.

            So in your existing Tcl proc make your output a Tcl list using list commands so that you get something like this:

            some data 1\.br\some data 2\.br\…

            becomes something like this:

            {{some data 1}{some data 2}…}

            The above could also be done using the STRING Action map function and a CONCAT without Tcl  if you so decide.

            Then if on 19.1 as indicated above use the User Type in an ITERATE. If not on 19.1 then using the List Type ITERATE with a basis of 0, using %l1 counter, and 1 and a Tcl proc to extract each element on your list returning the most current element and the remaining list and null in the most current element when the end of your list is reached.

            Inside the ITERATE if the element retrieved is not eq @null COPY =0 to $%l1 and COPY the current element returned to the next repetition of the OB OBX (you will need to manage your own counter).

            I have a proc that will extract current element and return current element and remaining list as well as a null when the list is exhausted. If you want that proc, email me.

            If you have questions about how to use the List ITERATE as I described above, email me.

             

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

          • #117835
            Charlie Bursell
            Participant

              Just out of curiosity.

              You say “requesting that we create multiple OBX-5 segments”.  OBX-5 is not a segment, it is a field.  Also you say the vendor does not want repeating fields.

              Does this mean multiple OBX segments with a different OBX-5 field? If so, would all of the other data in the OBX segment remain the same?  How about the count (OBX-1)?

              Just seems to be more to the problem than stated or maybe its just me 🙂

               

          Viewing 2 reply threads
          • You must be logged in to reply to this topic.