Modify sequence of data in ODS segment

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Modify sequence of data in ODS segment

  • Creator
    Topic
  • #52931
    Mike Campbell
    Participant

      I’m creating an outbound diet orders xlate.  I have several tcl procs called from the xlate to take inbound data, find an associated value in an oracle database and return that value.  All is working great.

      The only issue is they want any potassium values listed first.  

      As it is now, the outbound message is:

      ODS|D||NA2GM~K50~PRO60~DIABETIC~NA2GM~PRO80

      I need to get the K50 to appear first in the ODS segment.  

      Easiest to do in a post-proc?  Build an internal table to hold all values until I”m ready to send the message?  Any thoughts would be great.

      Thanks.

      CL  5.7 patch 2 on AIX.

    Viewing 4 reply threads
    • Author
      Replies
      • #75977
        Jim Kosloskey
        Participant

          Mike,

          I don’t see why you can’t do this in the Xlate without much or perhaps any Tcl.

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

        • #75978
          bill bearden
          Participant

            Split the field into a list, delimiter ~

            Loop through the list elements

             If K, add to new list

            Loop through the list elements again

             If not K, add to new list

            Join new list into string, delimiting with ~

            Stick the string back in the segment

          • #75979
            Michael Vork
            Participant

              Good solution, Bill.

            • #75980
              Mike Campbell
              Participant

                Thanks for all the good ideas.  The segment listed is actually the outbound message.  There are several points [different data elements and segments] within the inbound that I am retrieving that data so I’m thinking I need an array or something to hold all the data, then loop though looking for the K, then mapping out all the values after that.

              • #75981
                Alice Kazin
                Participant

                  I would use tcl code with a “lsort” command.

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