Variable counter in xlate iteration

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Variable counter in xlate iteration

  • Creator
    Topic
  • #55645
    Jason Puskar
    Participant

      Hello,

          Is there a way to use the value of a variable counter to value which iteration of a segment is used/valued?

          I have a situation were I am copying only some OBX segments over from Inbound to Outbound.  Each time I value a counter and value the OBX|1 field.  There is one OBX value (blood pressure) that come out in one OBX, but I have to place in two outbound.  I’ve held them in a variable to add to the end after all other OBX’s are processed.  At the end I know how many OBX’s are ready to send with the counter.  I would like to be able to value the last two OBX’s with the held value, and use the counter to control what iteration is used.

          Below is what I was trying to set up.  How can I do this?

      Copy @null -> @obxCounter

      ITERATE  (obx’s)

      Copy @obxfinalVal -> 1(0).1(0).1(0).OBX(@obxCounter).#1(0)

    Viewing 1 reply thread
    • Author
      Replies
      • #86003
        Jim Kosloskey
        Participant

          Jason,

          Using temp variables in address paths will always result in a value of zero (0).

          There is a way to do what you want but I need to have a little more detail.

          Email me and I will help you with this off line.

          The essence is you probably need to manage your own Iteration Variable (%g/s/f/lx) like %g99. There are some things to know about how and why to do this.

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

        • #86004
          Jason Puskar
          Participant

            Jim,

               Thanks so much for your help.  I was able to get this to work based on what you said.  

               I valued my own variable of $%s99 to 1.  I am still using the usual %s1 to loop through the OBX segments.  Once I find a value I want to copy, I just use the $%s99 variable on outbound side.  Next I increment my own custom variable by one for the next match.

                 Below is how the initializing, copy and incrementing looks in the xlate:

            Copy

            =1   –>   $%s99

            Match found, now copy to outbound:

            1(0).1(0).1(0).OBX(%s1).#5(0).[0]   –>   1(0).1(0).1(0).OBX(%s99).#5(0).[0]

            Math:Add

            $%s99   –>   $%s99

            =1

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