Generating a sequence number in an Xlate

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Generating a sequence number in an Xlate

  • Creator
    Topic
  • #48342
    Joe Guerra
    Participant

      I’m trying to add a counter that will increment by 1 for each record that is processed from the inbound file. The outbound file requires a unique number for each record, and I cannot figure out how to do this in the Xlate.  Any help would be appreciated. Thanks

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

          Joe,

          Are you talking about MSH-10 the Control ID or the sequence number field?

          I know with the Control ID some systems require the ID to never repeat in other cases they do not care as long as there is some large number before it repeats.

          If repetition is not an issue, you can use Tcl to exploit a Counter File which will keep incrementing until it reaches the limit you set.

          If it is the sequence number, then there are potential issues with whether the number needs to different (or not) if a message is resent also whether there can be ‘gaps’ in the number (such as a message getting killed on the outbound TPS then the sequence # might skip one or more numbers).

          Just some things to think about.

          Jim Kosloskey

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

        • #58358
          Rentian Huang
          Participant

            Also I guess, HL7 or FRL?

          • #58359
            Joe Guerra
            Participant

              Thanks Jim.  This is an FRL from the host system that i’m putting into a VRL comma delimited for the receiving system.  The receiving system just needs a unique number (counter incrementing by 1 would be perfect) in one of the fields.

            • #58360
              Rentian Huang
              Participant

                Joe,

                I think you can use the COUNTER mechanism to create a ctr file, and keep your counter there. Then in the IB Data TPS, use a Tcl to call CtrNextValue and assign it to the field.

                Sam

              • #58361
                Joe Guerra
                Participant

                  Thanks all.  I did write a proc with the COUNTER function, and calling it from the xlate.  It works great.

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