Iterate and then select

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Iterate and then select

  • Creator
    Topic
  • #49549
    Mark Perschbacher
    Participant

      I have an xlate that I am interating through multiple IN1 segments, copying IN1.00460 to .00428.  What I would like to do is evaluate .00428, and if it equals a certain value, copy .00460  to .00368, just for that segment, and not the others.  Can this be done in an xlate, or will it require a tcl snipet.  What do you think?

    Viewing 7 reply threads
    • Author
      Replies
      • #62445
        John Hamilton
        Participant

          Are you checking for a value or numerious values.

          Depending on how many and what you should be able to use the If  command to do it.

        • #62446
          Robert Milfajt
          Participant

            The short answer is yes you can.

            The long answer requries more knowledge of your HL7 formats and the values you want to copy.

            Basically, as you are iterating through the IN1 segments, insert an if command within the iterate loop with a copy command if the if is true.

            Hope this helps,

            Robert Milfajt
            Northwestern Medicine
            Chicago, IL

          • #62447
            Mark Perschbacher
            Participant

              I am looking for a specific four digit ID.  I have an IF operation within the interate, but it is not selecting just the matching segment.  I’ll search through the forum and see if I can find some examples of “if true” operators.  Thanks

            • #62448
              Mark Perschbacher
              Participant

                Well, I have tried it with and without Bulkcopy, and can’t get it to work.

                Here is what I have

                Iterate: Group 3(0).0 %g1

                Copy: 3(0).0(%g1).IN1.00460 -> @tmp

                Table: @tmp -> 3(0).0(%g1).IN1.428

                IF: 3(0).0(%g1).IN1.00428 == =9900

                Copy: 3(0).0(%g1).00460 -> 3(0).0(%g1).00328

                Here is what the output looks like, any ideas?

                3(0).0(0).IN1(0)  :  >|1||4000|PREMERA BC/BLUE CARD|PO BOX 91080^MAIL STOP 212^SEATTLE^WA^98111-9180|(800)676-2583||092000178|||||||O||||||||||||||||||||ODD|YVP920483274< 3(0).0(1).IN1(0)  :  >|2||1000|MEDICARE PART B|PO BOX 91080^MAIL STOP 212^SEATTLE^WA^98111-9180|(800)933-0614|||||||||P||||||||||||||||||||MA|543465147D< 3(0).0(2).IN1(0)  :  >|3||9900|ODS|PO BOX 91080^MAIL STOP212^SEATTLE^WA^98111-9180|(800)933-0614|||||||||P||||||||||||||||||||ODS|543465147D<

              • #62449
                Elizabeth Wilson
                Participant

                  What is the reason for the table? Can’t you check @tmp for the value?

                  If your table output is different than the Input and if you do need to translate, then after you copy @tmp to 3(0).0(%g1).IN1.428 your IF should look in

                  ~3(0).0(%g1).IN1.00428, not  3(0).0(%g1).IN1.00428

                  Try that.

                • #62450
                  Mark Perschbacher
                  Participant

                    I am running @tmp through the table to convert what the sending system is producing to what our LIS can recognize.  When I add the ~ to the condition of the IF statement, I get the “Value references must yield exactly one datum” error.

                  • #62451
                    John Hamilton
                    Participant

                      You should be able to use the variable in the if statement.

                      Try this.

                      Table: 3(0).0(%g1).IN1.00460 -> @tmp

                      IF: @tmp == =9900

                      Copy: 3(0).0(%g1).00460 -> 3(0).0(%g1).00328

                    • #62452
                      Mark Perschbacher
                      Participant

                        John, that did the trick.  It never ceases to amaze me how the simplest rearranging of operations, variables, and the order they are placed in can produce such different effects.  I moved the @tmp all around, created a second variable, but must not have had it just right.  Again, the generous users of this forum have come through, thanks ever so much!

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