Iteration

  • Creator
    Topic
  • #55704
    Mark Brown
    Participant

      I always have a terrible time with iteration.  What I’m trying to do with the XLATE is when there’s a “A” in RXC:1, then put “O” in ZRX:5. The people that wanted this to happen didn’t say there was the chance of multiple RXC segments so I was going update ZRX:5 if any RXC:1 fields had “A”. I don’t get an error, but I don’t populate ZRX:5 either.  Here is the XLATE:

      { { OP DATECOPYOPT }

         { ADDPREC 0 }

         { FABRICATE 1 }

         { USECURTM 1 }

         { RANGE {49 20 19} }

         { TMDEFS {01 01 00 00 00 0000 +0000} }

         { DELIMIT {/ :} }

      }

      { { OP BULKCOPY }

         { ERR 0 }

      }

      { { OP ITERATE }

         { BASIS 2(0).2(0).RXC }

         { VAR %s1 }

         { TYPE segment }

         { BODY {

             { { OP COMMENT }

                 { COMMENT {TODO: Insert new actions here} }

             }

             { { OP IF }

                 { ERR 0 }

                 { COND { 2(0).2(0).RXC(%s1).#1(0)  eq =A} }

                 { THENBODY {

                     { { OP COMMENT }

                         { COMMENT {TODO: Insert new actions here} }

                     }

                     { { OP COPY }

                         { ERR 0 }

                         { IN =O }

                         { OUT 2(0).2(0).ZRX(0).#5(0) }

                     }

                 }}

                 { ELSEBODY {

                 }}

             }

         }}

      }

    Viewing 5 reply threads
    • Author
      Replies
      • #86222
        Jim Kosloskey
        Participant

          Mark,

          Make sure your basis is correct and thus this is really a segment repetition and not a group repetition.

          After that, if still not working I would investigate whether you need to reference at the component level in your IF.

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

        • #86223
          Mary Kobis
          Participant

            I use the testing tool, HL7 tab, to verify my basis with the inbound message.

          • #86224
            Jim Kosloskey
            Participant

              Mark,

              Make sure your basis is correct and thus this is really a segment repetition and not a group repetition.

              After that, if still not working I would investigate whether you need to reference at the component level in your IF.

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

            • #86225
              Keith McLeod
              Participant

                When using the testing tool to determine the basis, make sure you reference the same source variant used in you xlate.  Paths can be different depending on the variant.

              • #86226
                Mark Brown
                Participant

                  This just got strange. I know I probably committed some kind of sin for doing this, but I wrote the XLATE on our test engine which is 6.2. I decided to create the XLATE on our production system which is still 6.0. It didn’t work either. I found an error in the variant I created.  I fixed that. Still didn’t work.  I then spent time deleting, re-adding, changing the XLATE around until I got it back to how it was originally.  And now it works.  The XLATE is identical to what is on 6.2 and it originally didn’t work, but  now it does.  I used the same file for test input in both cases.

                  I’m more worried than happy it’s working now.

                • #86227
                  Jim Kosloskey
                  Participant

                    Mark,

                    There is known issue (I hoped it would be corrected in 6.2 but apparently not).

                    That issue is sometimes when in an IF or an ITERATE and changes are made, they show up in the GUI but are not committed to the file.

                    This issue has caused me grief many times (and I suspect others was well).

                    What I do is if it appears the changes I have made are not being shown in testing, I close the Xlate then open it again. I then check the section of logic I had an issue with. Many times the changes are not there and I need to make them again.

                    That could be what happened to you.

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

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