Iterations – Eplanation for group vs segment basis

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Iterations – Eplanation for group vs segment basis

  • Creator
    Topic
  • #53894
    Femina Jaffer
    Participant

      Hello,

      I was wondering if anyone can give me an explanation (simple one) on the difference between a segment iteration and a group iteration?  When would you use one over the other and when you would use both.  I am able to now do some of these successfully; but, still do not have a clear understanding of when to use what.  I may be doing both when it is actually not needed.

      Thank you.

      Femina

    Viewing 3 reply threads
    • Author
      Replies
      • #79415
        bill bearden
        Participant

          It depends on what repeats. If the group is repeating, you probably want to iterate on the group. If it is just the segment that is repeating, you probably want to iterate on the segment. And, it can be both. Remember, curly braces, {}, mean repeating.

          I am looking in Cloverleaf at the ADT_A01 2.6 variant. I am looking at it in the xlate configurator.

          In group 0, you can see that the group doesn’t repeat but the NK1 segment repeats. You won’t need to iterate on the group to get any of the segments but you will need to itereate on the NK1 segment to see all the NK1 segments. The same is true in group 3 and the AL1 segment.

          But if you look at group 4, you see that the whole group repeats. I am looking at group 6 and the IN1 segment. The group repeats but the segment doesn’t. That is, you have to iterate on the group but not on the segment to get all the IN1 segments.

          Also in group 6, look at segment IN3. Remember, group 6 repeats. But segment IN3 also repeats. Here, you have to iterate on the group to get all the groups IN1 [IN2] [{IN3}] [{ROL}]. But in each group, you have to iterate on the IN3 segment to get all the IN3 segments.

        • #79416
          Femina Jaffer
          Participant

            Wow!  Thankis Bill for the overview.  I followed everthing you said and pulled up the variant on my screen too.  That is great insight.

            Thanks again.

            fj

          • #79417
            Femina Jaffer
            Participant

              Bill,

              Just to clarify:

              I have attached a screenshot of my inbound variant.  1.1.0 and 1.1.1 are separate groups, right?  So, the OBR would require both a group iterate and a segment iterate within the group if I needed to iterate over it, correct?  Now, what about the NTE segment under the OBX…Would that be a separate group iterate, a segment iterate within?  

              Thanks,

              Femina

            • #79418
              bill bearden
              Participant

                Yes, 1.1.0 and 1.1.1 are different groups within the group, 1.1. They are a little different in that 1.1.0 does not repeat within 1.1 but 1.1.1 does.

                You have picked a complicated example. The lab results we get from Sunquest only have one patient per message so, here, we can ignore the repeating of the group, 1. But, you might even have to iterate group 1 and use that iterate variable in all your field references that start with a 1. Assuming you don’t have to do that, to get to all the NTE in 1.1.0,

                Iterate Group 1.1 %g1

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