Adding Additional Repeats from other Fields

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Adding Additional Repeats from other Fields

  • Creator
    Topic
  • #53528
    Jon Melin
    Participant

      Hello!

      Thank you for taking some time to view my issue.

      I am trying to move a PID#4 to an additional iteration of PID#3. Essentially I want all the patient IDs to be iterations of PID3 (Screenshot attached). I first attempted to use the MATH feature to track which iteration it was on and copy it over using the iterate variable but I only ever get 0 or 1 for the value when it should be returning 2 or 3 in my test examples, no matter where I move the MATH function. It appears like the iterate isn’t returning to the top of the iterate and working it’s way back down each time (this is an assumption about general iterates). Please let me know if anyone has any suggestions.

      I just want my PID4 patient ID’s to be added to additional iterations of the PID3.

      Thank you in advance,

      Jon

    Viewing 3 reply threads
    • Author
      Replies
      • #77999
        Jim Kosloskey
        Participant

          Jon,

          My suggestion is to use your own counter rather that the %f1 established with the ITERATE for your outbound, MATH ADD.

          I typically use something like %f99 and work my way down for my own counters. That is like an eye catcher for me for maintenance. If I see %g99 or %f99 or %l99 or %s99 I know those are my counters not ones established by an ITERATE and I should see specific handling for them.

          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

        • #78000
          Jon Melin
          Participant

            Jim,

            Thank you for the reply. I had it as %f99 but changed it, I have now changed it back. It still is only returning me a 0 for the %f99. Do you see anything wrong with the structure or where the MATH function is? I feel I am missing something small but can’t see it.

            What it does now is my variable returns 0 and it puts the PID4 into the PID3(0) location, replacing the first iteration, because the counter isn’t working.

            Thoughts?

            Thank you,

            Jon

          • #78001
            Keith McLeod
            Participant

              I usually 0 out my counter up from with copy =0 to $%f99.

              Then for you math add statement make it $%f99 =1 MATH ADD $%f99.

              Your location I beleive is fine.

              You need to use your iteration counter of %f1 on the source side in your path for the field you are iterating over and on the destination side use %f99 in the path for the destination instead of the %f1.

              Use the math add statement on you PID:3 iteration just to keep it at the proper iteration.  Without reinitializing %f99 also use it for the iteration over PID:4 when you copy PID:4 to PID:3 for example using the correct paths.

              Copy =0 –> $%f99

              Iterate over PID:3(You can use %f1)

                  Copy PID(%f1):3 –> PID(%f1):3

                  MATH ADD $%f99 =1 –> $%f99 (This is only to keep the count)

              Iterate over PID:4(You can use %f1, it initializes each time iterate is call)

                  Copy PID(%f1):4 to PID(%f99):3

                  MATH ADD $%f99 =1 –> $%f99 (This is only to keep the count)

              Hope this helps…

            • #78002
              Jon Melin
              Participant

                Yes it does. Thank you for the reply. I got it to work, apparently I did have to instantiate the variable with 0 in order for it to work.

                Thank you,

                Jon

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