IF STATEMENT USE WITH REPEATING OBX

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf IF STATEMENT USE WITH REPEATING OBX

  • Creator
    Topic
  • #51373
    Cynthia Briscoe
    Participant

      I have a system that is sending ORU messages for orders that are canceled with ORC of RE.  In OBX;5 there is verbage stating the order is Cancelled.  The receiving systems need an ORM with a status of OC.  I tried an IF statement  “IF  1(0).1(0).1(0).OBX.00573(0).[0] eq @CANCEL “

      and then under that did a copy of =ORM in MSH.0009.(0).  The first time I tried this is worked however for bonifide results with repeating OBX segments it cut out all the repeat OBXs and only allowed one OBX.  I tried doing an If statement under an Iterate of the OBX but it did not work  and quit finding the “Cancel” in my “if “statement.  I went back to square one and now the original does not work.  I hope someone can help me out here.

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

          If I understand correctly you have an ORU inbound message and want to create an ORM outbound message if an OBX-5 field in any repetition contains some value that you have initilized in the temp variable @CANCEL.

          Is that correct?

          Also you want to have an ORU outbound message if no OBX-5 field in any repetition has a value of whatever is in @CANCEL.

          Is that correct?

          Inside your ITERATE be siure to place your iteration counter in the appropriate positin of the address path.

          In your case it appears the OBX is a part of a repeating group (that is pretty standard) so assuming that in the ITERATE you set your counter to %g1, your IF should be:

          “IF  1(0).1(0).1(%g1).OBX.00573(0).[0] eq @CANCEL “

          Maybe that is your issue when iterating.

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

        • #69929
          Cynthia Briscoe
          Participant

            I am not sure I have the variable or the Interate set up right.  I have attached a screen shot of the interate and the whole xlate.

          • #69930
            Jim Kosloskey
            Participant

              If you have repeating OBXs and a repeating field in the OBX, you will need 2 iterates.

              One iterate will undoubtedly be a group iteration and have a counter of %gx (where x is some number).

              The otther iterate will be nested inside the first iterate and will be a field iteration and have a counter of %fx (where x is a number).

              In the second iterate remember to put your group counter (%gx) in the appropriate position in the address path of the basis (otherwise you will iterate over the field of only the first OBX)

              When referencing the inbound OBX fields then you need to always use the %gx counter appropriately and with the repeating OBX field also use the %fx counter appropriately in their respective address paths.

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

            • #69931
              Cynthia Briscoe
              Participant

                Why is the first iterate a group iterate and not a segment iterate since the OBX is a segment?

              • #69932
                Robert Kersemakers
                Participant

                  Because your first iteration is a group meaning it contains several (repetitions of) segment or other groups.

                  For example in an ORU message:

                  Code:

                  MSH
                  PID
                  [{NTE}]
                  [PV1]
                  [ORC]
                  {
                     OBR
                     [{OBX}]
                  }

                  At the end of this message, there is a group, where each element of the group consists of one OBR segment, followed by zero or more OBX segments.

                  So you will first need to iterate over this group. The OBR can then be reached, because there is always one OBR segment, but to get to the OBX segments, you need to iterate over the OBX segments within this group.

                  Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

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