How best to skip copying null subfields

Clovertech Forums Cloverleaf How best to skip copying null subfields

  • Creator
    Topic
  • #117860
    DS Hunt
    Participant

      I have the following field value: datax~~dataz

      I would like to skip copying the NULL subfield to the outgoing message: datax~dataz

      What is the best method to handle this?

       

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

          Assuming Xlate. This is a repeating field.

          Use a Field level ITERATE (lets say variable is %f1).

          You will need your own variable for the OB since it will not match the number of iterations in the IB. Lets call that %f99.

          At the beginning of the Xlate initialize your counter

          COPY =0 to $%f99  <– that is a zero.

          Inside the field level ITERATE:

          1. Check the current iteration of the field for not eq to @null
            1.   If true:
              1. COPY the current iteration of the field (using %f1 in the address path) to the OB field using %f99 in the address path
              2. MATH ADD =1 $%f99  result in %f99

          If you have any questions or would like some assistance, email me.

           

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

        • #117874
          Charlie Bursell
          Participant

            Assuming you want to replace all ~~ with ~:

            A simple solution would be a small Tcl proc in the route like:

            run {
            keylget args MSGID mh
            msgset $mh  [string map

              [msgget $mh]]
              return “{CONTINUE $mh}”
              }

              just a suggestion.  Jim likes Xlate for everything while i generally like TCL 🙂

            1. #117883
              DS Hunt
              Participant

                Thanks to both of you!

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