Using fragment code to change the xlateOutList

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Using fragment code to change the xlateOutList

  • Creator
    Topic
  • #50160
    Jeannette Wistrom
    Participant

    What do you specify for the destination if you need to change the destination using the xlateOutList in tcl fragment code?

    I have non-iterating xml fields that I need to convert into repeating hl7 OBX segments and I am trying to do this with a fragment code that  manipulates the xlateOutList.   When I define the destination as 1(0).1(0).1(0).OBX(0).#5 and my script reads in a counter and puts it in the xlateOutList as 1(0).1(0).1($obxctr).OBX(0).#5, the echo shows that the xlateOutList is what I want 1(0).1(0).1(1).OBX(0).#5, but it outputs to the destination 1(0).1(0).1(0).OBX(0).#5.  Is there a trick to this?

Viewing 2 reply threads
  • Author
    Replies
    • #65072
      Robert Milfajt
      Participant

      Remember xlateOutList is a list and not a string.  If you are setting it equal to a string, that will be a problem, i.e.,

      Code:

      set xlateOutList “1(0).1(0).1($obxctr).OBX(0).#5”

      is not the same as

      Code:

      set xlateOutList [list “1(0).1(0).1($obxctr).OBX(0).#5″]

      This maybe your problem.

      Robert Milfajt
      Northwestern Medicine
      Chicago, IL

    • #65073
      Jeannette Wistrom
      Participant

      I did get it working with the help of a friend that lead me in the right direction.

      First we concatenated the different pieces of data into the OBX.5 field with @ as our delimiter.  We then brought in the destination as our source:  (We added a couple of other fields that we needed to hard code information in for each segment)

      ~1(0).1(0).1(0).OBX(0).#5  


      contains our data

      ~~1(0).1(0).1(obxcnt).OBX(0).#1    


       output starts with 1 and increments for each segment

      ~~1(0).1(0).1(obxcnt).OBX(0).#2  


       hardcode value for each segment

      ~~1(0).1(0).1(obxcnt).OBX(0).#5  


       split our data on @ and created OBX segment for each value in our list

      ~~1(0).1(0).1(obxcnt).OBX(0).#11  


        hardcode value for each segment

      Here is the code we used to create the different OBX segments:

      echo $xlateInVals

      set datalist [split [lindex $xlateInVals 0] “@”]

      echo $datalist

      set obxcnt 0

      set outList {}

      set xlateOutVals {}

      foreach value $datalist {

         set current [ string trimleft [ lindex $xlateInList 1 ] “~” ]

         regsub obxcnt $current $obxcnt current

         set outList $current

         set outval [ expr $obxcnt + 1 ]

         xpmstore $xlateId $outList c $outval                            set current [ string trimleft [ lindex $xlateInList 2 ] “~” ]

         regsub obxcnt $current $obxcnt current

         set outList $current

         set outval “TX”

         xpmstore $xlateId $outList c $outval

         set current [ string trimleft [ lindex $xlateInList 3 ] “~” ]

         regsub obxcnt $current $obxcnt current

         set outList $current    

         xpmstore $xlateId $outList c $value

         set specimenStatus [ lindex $xlateInVals 5 ]

         if { $specimenStatus == “” } {

             set specimenStatus “F”

         }

         set current [ string trimleft [ lindex $xlateInList 4 ] “~” ]

         regsub obxcnt $current $obxcnt current

         set outList $current    

         xpmstore $xlateId $outList c $specimenStatus

         incr obxcnt

         echo obxcnt $obxcnt

      }

      [/img]

    • #65074
      Russ Ross
      Participant

      You might find my post on how I used xpmstore to create extra NTE segements usefull to look at.

      http://clovertech.infor.com/viewtopic.php?t=2206” class=”bbcode_url”>http://clovertech.infor.com/viewtopic.php?t=2206

      The proc of intrest is called xlt_create_NTE_from_OBX7.tcl

      Russ Ross
      RussRoss318@gmail.com

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

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,296
Replies
34,439
Topic Tags
287
Empty Topic Tags
10