Xlate – Math Add

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Xlate – Math Add

  • Creator
    Topic
  • #48879
    Femina Jaffer
    Participant

      Hello Clovertechies:

      I need to ask for your assistance again.  I need to increment the ID in each NTE segment created in the outbound.  How can this be done in an xlate?  I have played with this all day using math add and just am not having any luck.

      e.g. NTE|1||

           NTE|2||

           NTE|3||

      Thanks!

      fj

    Viewing 6 reply threads
    • Author
      Replies
      • #59978
        Russ Ross
        Participant

          Attached is a screen shot that illustrates using math add to increment a temp variable @g1 in one of my Xlates that might help you get it to work.

          If memory serves me right, I think you can also use the %g1 or %s1 values to set your NTE counter/ID by referring to it with the notation $g1 or $s1 in your Xlate copy.

          Perhaps others can comment on this feature in case I got the notation wrong.

          I had already used the temp variable method of @g1 before I had heard about the $g1 notation so never got a chance to try it.

          Russ Ross
          RussRoss318@gmail.com

        • #59979
          Jim Kosloskey
          Participant

            Femina,

            Use a Temp variable to contain the counter – example @nte_ctr

            In your MATH ADD Action Source list:

            =1

            @nte_ctr

            In the Destination  List:

            @nte_ctr

            The above says ADD 1 to @nte_ctr putting the result in nte_ctr.

            Then COPY @nte_ctr to the NTE Set ID field.

            Don’t forget to initialize your temp variable at the beginning of your Xlate and reset it if necessary when and if the Iteration restarts.

            Jim Kosloskey

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

          • #59980
            Robert Kersemakers
            Participant

              Russ Ross wrote:

              If memory serves me right, I think you can also use the %g1 or %s1 values to set your NTE counter/ID by referring to it with the notation $g1 or $s1 in your Xlate copy.

              That would be $%g1 and $%s1 to reference %g1 and %s1. I often use these variables, because you can manipulate them using MATH. And you can use them as a index; you can’t do that with @g1.

              Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

            • #59981
              Femina Jaffer
              Participant

                Hello All,

                Thank you all so much for your prompt responses.  However, I am still having the same problem as before.  The second NTE segment does not increment to 2 in the seg ID.

                I have attached my xlate for your review.  My output looks like this:

                1(0).1(0).1(0).OBX(0)  :  >|1|NM|                            < 1(0).1(0).1(0).NTE(0)  :  >|1||Performed at ABC LAB < 1(0).1(0).1(0).NTE(1)  :  >|1|| ZZZ PLACE,  ABC, NM < THE second NTE needs to increment to ‘2’.  But, both are ‘1’. Thank you. Mina

              • #59982
                Femina Jaffer
                Participant

                  Hello everyone,

                  I got it!  I figured out what I had done wrong.  Again, thank you all for your help.  I really did appreciate it!

                  fj

                • #59983
                  Femina Jaffer
                  Participant

                    I am still having this problem, and cannot get it to work.  I apologize for speaking so soon.

                    fj

                  • #59984
                    Femina Jaffer
                    Participant

                      Thank you for point out my mistake Jim.  It definitely was the COPY statement out of place.  I moved it before the first ITERATE and it worked like a charm.

                      Thanks again!

                      FJ

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