How to remove unwanted Pipes at the end of a segment

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf How to remove unwanted Pipes at the end of a segment

  • Creator
    Topic
  • #55191
    Brian Craig
    Participant

      I am working on a tcl proc to replace OBX’s with NTE’s  I cannot figure out how to remove the unwanted pipes at the end of the segment.  Has anyone successfully removed unwanted pipes?

    Viewing 2 reply threads
    • Author
      Replies
      • #84520
        Jim Kosloskey
        Participant

          Are the pipes a result of an Xlate?

          If so, then one way is to change the outbound variant so that any fields past the last one actually populated are not required.

          If the Xlate sees any required fields it will add all of the intervening field separators as the field has to exist.

          So say a segment with 3 fields:

             Field_1 required

             Field_2 optional

             Field_3 required

          If only Field_1 is populated by the Xlate (say with ‘stuff’ as the value) then the output would be:

          SEG|stuff||

          if the definition is changed to this:

             Field_1 required

             Field_2 optional

             Field_3 optional

          then the result would be:

          SEG|stuff

          Of course you could always write some tcl to be executed post Xlate but why?

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

        • #84521

          I agree with Jim. Run the message through an Xlate which will remove all trailing delimiters.

          -- Max Drown (Infor)

        • #84522
          Michael Hertel
          Participant

            And if it is not due to Xlate

            set seg [string trimright $seg $fsep]

            or

            set seg [string trimright $seg |]

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