Using a continue in an interation

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Using a continue in an interation

  • Creator
    Topic
  • #48032
    Scott Baker
    Participant

    I have an ORU message that has 3 OBR segments with multiple OBX segments for each OBR.  I have been asked to create a message for each OBR.  I have been able to achieve this by putting a Continue in the OBR group iteration.  The problem I am having is that the second OBR always has more OBX segments than the third OBR which causes the last part of the second message to append to end of the third message.  For example if the second OBR has 10 OBX lines and the third OBR has 6 OBX lines my last message has the 6 OBX lines that are supposed to be there and then the last 4 OBX lines from the second message for a total of 10 lines instead of 6.  I was able to find some reference to this problem before in the archives but I coulsn’t make much sense of the solution.  If someone has a good way of clearing out the OBX lines from the previous message I would greatly appreciate your help.  This has been very frustrating!   Thanks.

    Scott Baker – Sr. Technical Analyst

    Information Services

    H

Viewing 4 reply threads
  • Author
    Replies
    • #57408
      Michael Lacriola
      Participant

      You need to PATHCOPY @NULL over the outbound OBX segments after the CONTINUE segment and before your next ITERATE over the OBR segments.

      so…

      ITERATE over OBR

        ITERATE over OBX

           COPY OBX segments to outbound message

        CONTINUE meesage when OBX iteration complete

        ITERATE over outbound OBX message to clear OBX lines

      Hope this gets you going.

    • #57409
      Keith McLeod
      Participant

      I believe you would need to pathcopy @null to the OBX at the beginning of your iterate.  This should clear the OBX for that particular iteration and then the rest of your code should populate the OBX correctly.  You may need to do this for other segments within the group.

    • #57410
      Scott Baker
      Participant

      The solution that Michael suggested worked perfectly.  Thanks.

    • #57411
      Rentian Huang
      Participant

      Scott,

      Can you send the code you used to:

      ITERATE over outbound OBX message to clear OBX lines

      Thanks,

      Sam 🙂

    • #57412
      Scott Baker
      Participant

      Sam,

      I basically did the following:

      ITERATE over OBR (group 1)

       ITERATE over OBX (group 2)

          COPY OBX segments to outbound message

       CONTINUE message when OBX iteration complete

       ITERATE over outbound OBX message to clear OBX lines (group 2)

      The basis for the group1 iteration in my variant is: 1(0).1 and the variable is %g1.

      The basis for the group2 iteration in my variant is: 1(0).1(%g1).1 and the variable is %g2

      I hope this helps.

      Scott.

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

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,295
Replies
34,439
Topic Tags
287
Empty Topic Tags
10