Iteration findin addition fields not in the original Input

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Iteration findin addition fields not in the original Input

  • Creator
    Topic
  • #54069
    Don Anderson
    Participant

      Original Inbound msg, Iterating on PID-10 for RACE “CAU~MAL”

      Using a basic Code Frag

      set OUT [lindex $xlateInVals 0]

      set OUTD ~

      append OUT3 $OUT $OUTD

      set xlateOutVals $OUT3

      PID|1|2359349^^^Enterprise MRN^MRN|2359349^^^Enterprise MRN^MRN|2359349^0^^Enterprise MRN^Account No|Zztesttwo^Lexington^^^^^Current||19990926120000|Male|Zztesttwo^Lexington^Middle^^^^Preferred~Zztest2^Lexington^^^^^Previous|CAU~MAL|1900 Richmond Rd^^Lexington^KY^40502^USA^Home^^FAYETTE~1900 Richmond Rd^^Lexington^KY^40502^USA^Mailing^^FAYETTE~^^^^^USA^temporary||(859)000-0000^Home~(000)000-0000^Pager personal~(000)000-0000^Fax Personal~(123)456-7890^Alternate^^^^^^^sdfghjkl;|(000)000-0000^Business|English|S|Non Provided|7004085^^^FIN Number^FIN NBR||||Non-Hispanic|||0

      Output VRL File “MAL~CAU~MAL~CAU~CAU~MAL~”. When using the test Tool there is no issue. Only when the transaction is replayed from SMAT or sent from originating system. The amount of output iterations varies from 1 to 12+

      A01|2359349|7004085|Zztesttwo|Lexington|1900 Richmond Rd||Lexington|FAYETTE|KY|40502|(859)000-0000|19990926120000|Male|MAL~CAU~MAL~CAU~CAU~MAL~|S|Inpatien

      Any Assistence would be greatly appreciated

    Viewing 12 reply threads
    • Author
      Replies
      • #80064
        Robert Milfajt
        Participant

          Some quick things.

          1.  Set xlateOutVals as if it was a list, i.e.,

          Code:

          set xlateOutVals [list $OUT3]

          2.  Would need to see your iterate to make sure the issue isn’t in the basis or something else.

          3.  Looks like OUT3 is a variable your using within the Xlate.  Did you remember to initialize it prior to use.  Might be helpful to see the whole ITERATE and statements within.

          Thanks,

          Bob

          Robert Milfajt
          Northwestern Medicine
          Chicago, IL

        • #80065
          Don Anderson
          Participant

            When you reference initialize the variable what do you mean?

            This is the complete code fragment

            set OUT [lindex $xlateInVals 0]

            set OUTD ~

            append OUT3 $OUT $OUTD

            set xlateOutVals $OUT3

            I updated it to reflect set xlateOutVals

              Source 0(0).PID(0).#10(%f2).[0]

              type = field

              Basis = 0(0).PID(0).#10

              Variable %f2

              Destination = race (VRL)

          • #80066
            Terry Kellum
            Participant

              If you remember your engine internals, the TCL interpreter in the Translate is shared.  You can wind up stacking entries in the OUT3 variable as you go thru transactions in the xlate.

              Something like

              set out3 0

              unset out3

              will clear the variable and insure that you have a clean slate each time.

            • #80067
              Terry Kellum
              Participant

                My TCL book informs me that you can also use a -nocomplain argument to unset.

                unset -nocomplain out3

              • #80068
                Don Anderson
                Participant

                  I added unset -nocomplain out3 and it’s still stacking them

                  set OUT [lindex $xlateInVals 0]

                  set OUTD ~

                  append OUT3 $OUT $OUTD

                  set xlateOutVals

                    unset -nocomplain out3

                    Do I have it in the wrong place?

                • #80069
                  bill bearden
                  Participant

                    Maybe…

                    unset -nocomplain OUT3

                                             


                  • #80070
                    Don Anderson
                    Participant

                      Caught that right away, still the same result, its not clearing unless I cycle the process

                    • #80071
                      Terry Kellum
                      Participant

                        I’d put it before the logic.  You need to start with a clean slate.

                      • #80072
                        Charlie Bursell
                        Participant

                          You don’t need to unset it just set to empty string any variables you are creating using append or lappend

                          In the Xlate somewhere before you start using you can

                          COPY @null -> @null   Then a Tcl snipett in there to initialize your variables

                        • #80073
                          Don Anderson
                          Participant

                            @null -> @null

                            Iterate

                            set OUT [lindex $xlateInVals 0]

                            set OUTD ~

                            append OUT2 $OUT $OUTD

                            HL7 Input = PID-10 |CAU~MAL|

                            Replayed a couple of times from Application and got in my Flat File

                            |BLA~CAU~BLA~CAU~|

                            Works in Testing Tool with no problem, when resent from outside app it concat

                          • #80074
                            David Barr
                            Participant

                              Don Anderson wrote:

                              @null -> @null

                              Iterate

                              set OUT [lindex $xlateInVals 0]

                              set OUTD ~

                              append OUT2 $OUT $OUTD

                              Where are you clearing OUT2?

                            • #80075
                              Don Anderson
                              Participant

                                Charlie said to not use it so I took it out

                                When I put it in I got only the first iteration |CAU~| even when resent from the application

                                set OUT [lindex $xlateInVals 0]

                                set OUTD ~

                                append OUT2 $OUT $OUTD

                                set xlateOutVals

                                  unset -nocomplain OUT2

                              • #80076
                                Bob Richardson
                                Participant

                                  Greetings,

                                  I would suggest using a tempvar in your xlate itself.

                                  Steps:

                                  (1) COPY @null to @out3

                                  (2) Iterate on field

                                      (a) CONCAT @out3 field(%f1) –> @out3 using tilde (~) as the SEP

                                  (3) COPY @out3 –> VRL#field

                                  Good luck!

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