Xlate ITERATE problem

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Xlate ITERATE problem

  • Creator
    Topic
  • #51913
    Graham Hartley
    Participant

      Hi all,

      I have an inbound message (not HL7) which contains amoungst other things one primary procedure and zero or more secondary procedures.  The information for both of these is to be mapped to the repeating PR1 (HL7 segment).  What I want to do is store the primary procedure in PR1(0) and the secondary procedures in PR1(n).  I can populate the secondary procedures using the following iterate but it just overrides the primary procedure information.  Ideally what I want to do is for the iterate to start populating segments after the primary procedure information (PR1(1) and above).  The primary procedure information is stored in a different inbound segment

      Any suggestions as to how this can be done?  

      I am using Cloverleaf V5.3

      { { OP COPY }

         { ERR 0 }

         { IN {=0 =OPCS =SEG4.OPCS_Primary_Intended_Procedure_Code} }

         { OUT {0(0).PR1(0).00391 {0(0).PR1(0).00392.[0]]} 0(0).PR1(0).00393} }

      }

      { { OP ITERATE }

         { BASIS SEG5 }

         { VAR %s1 }

         { TYPE segment }

         { BODY {

             { { OP COMMENT }

                 { COMMENT {TODO: Insert new actions here} }

             }

             { { OP COPY }

                 { ERR 2 }

                 { IN {{$%s1}} }

                 { OUT 0(0).PR1(%s1).00391 }

             }

             { { OP COPY }

                 { ERR 2 }

                 { IN =OPCS }

                 { OUT 0(0).PR1(%s1).00392 }

             }

             { { OP COPY }

                 { ERR 2 }

                 { IN SEG5(%s1).OPCS_Secondary_Intended_Procedure_Code }

                 { OUT 0(0).PR1(%s1).00393 }

             }

         }}

      }

      Output using the Xlate test GUI

      0(0).PR1(0).00391(0).[0].[0] “Set ID – PR1” : >0< 0(0).PR1(0).00392(0).[0].[0] “Procedure Coding Method” : >OPCS< 0(0).PR1(0).00393(0).[0].[0] “Procedure Code” : >W21.1< 0(0).PR1(1).00391(0).[0].[0] “Set ID – PR1” : >1< 0(0).PR1(1).00392(0).[0].[0] “Procedure Coding Method” : >OPCS< 0(0).PR1(1).00393(0).[0].[0] “Procedure Code” : >W11.1< 0(0).PR1(2).00391(0).[0].[0] “Set ID – PR1” : >2< 0(0).PR1(2).00392(0).[0].[0] “Procedure Coding Method” : >OPCS< 0(0).PR1(2).00393(0).[0].[0] “Procedure Code” : >W33.1< Thanks in advance for your assistance. Graham

    Viewing 4 reply threads
    • Author
      Replies
      • #72256
        Tom Rioux
        Participant

          Graham,

          Trying adding a line of code as your first entry in the iterate to add 1 to the $%s1 variable.   When you iterate, the count always starts at 0, therefore it is overwriting what you placed in the first PR1 segment just before the iterate.

          Hope this helps….

          Tom

        • #72257
          Graham Hartley
          Participant

            Hi Tom,

            Thanks for your quick reply.  I can add 1 to this variable but if I do this it skips over the 1st secondary procedure.  This is because the variable is used in the following..

            { IN SEG5(%s1).OPCS_Secondary_Intended_Procedure_Code }

            { OUT 0(0).PR1(%s1).00393 }

            I think what I need is a different variable that I can reference in the OUTPUT so that %s1 iterates through SEG5 and another variable (which will be %s1 +1) populates the HL7 say PR1(newVariable).  However I am not sure if/how you can use multiple variables in an iterate.

            Any more suggestions please?

          • #72258
            Tom Rioux
            Participant

              You can use multiple variables.   Just pick a variable you know won’t be used (i.e. %s99).   Just set the %s1 variable to %s99 and increment the %s99 variable as needed.

              Tom

            • #72259
              Graham Hartley
              Participant

                Thanks Tom.  That worked a treat.

              • #72260
                David Harrison
                Participant

                  Graham,

                  You’re obviously a CliniCom PAS user.

                  Here’s an example of how I’ve tackled this kind of issue

                  Code:

                  { { OP ITERATE }
                     { BASIS RES_SEG2 }
                     { VAR %s1 }
                     { TYPE segment }
                     { BODY {
                         { { OP ADD }
                             { ERR 0 }
                             { IN {{$%s1} =1} }
                             { OUT @obxctr }
                             { FUNCTION ADD }
                         }
                         { { OP COPY }
                             { ERR 0 }
                             { IN @obxctr }
                             { OUT {{1(0).1(0).1(%s1).OBX(0).#1(0).[0]}} }
                         }

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