Iterate through list problem

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Iterate through list problem

  • Creator
    Topic
  • #52026
    Elijah Park
    Participant

      There has been much said on the topic of iteration, but here’s a new one. Hope you’re up for a challenge.

      Goal: Iterate through 2 groups of incoming frl fields (diag_1 thru diag_10 then dg2_1 thru dg2_11) placing them in HL7’s 0(0).DG1(1) thru 0(0).DG1(21).

      Problem: The first iteration through (list 1 thru 10) works fine. However, when iterating a second time from 1 thru 11 and incrementing the variable by 10, our output gives unexpected results. Help!

    Viewing 4 reply threads
    • Author
      Replies
      • #72770
        Jim Kosloskey
        Participant

          Daniel,

          Why not set up the FRL fields as repeating and ITERATE as repeating fields rather than trying the brute force list repetition?

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

        • #72771
          James Cobane
          Participant

            Daniel,

            In your second iteration, you are using a temp field as the iteration variable on your outbound field (0(0).DG1(@ctr).#3. I don’t believe you can do that, hence the unexpected results.  You’ll need to use an iteration variable (i.e.%l4) and value that in your MATH action instead of @ctr; reference it the same as you do your %l3 variable by using the $ (i.e. $%l4).  Then use that iteration variable in your outbound field path (0(0).DG1(%l4).#3

            Hope this helps.

            Jim Cobane

            Henry Ford Health

          • #72772
            Elijah Park
            Participant

              Jim K, sounds like a neat idea…didn’t know you could set an FRL field to repeat.

              Jim C, it works like a charm!

              Thank you both.

            • #72773
              Jim Kosloskey
              Participant

                Dan,

                It has been a while since I did any ITERATEs over FRL and I thought I simply set up the field names thus:

                field_0

                field_1

                field_2

                Then in the Xlate ITERATE selected any one of those fields and Copied to Basis.

                I could not find any actual examples of me doing FRL ITERATE so I tried the above in Cloverleaf 5.6 and the basis cannot be set in the manner I recalled.

                It is likely my memory is faulty and the method you are using is the method I actually utilized. However I just don’t recall having to know exactly how many occurrences there would be when setting up the ITERATE for FRL (which using a list ITERATE requires).

                I think the last time I needed to do something like this was on release 3.3.1 of Cloverleaf.

                Sorry if I gave false hope.

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

              • #72774
                Elijah Park
                Participant

                  NP Jim. I appreciate your feedback.

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