pulling mulitple fields

Clovertech Forums Read Only Archives Cloverleaf Tcl Library pulling mulitple fields

  • Creator
    Topic
  • #51163
    Kevin Crist
    Participant

      i am trying to pull the consulting dr and admitting dr from the PV1 fields. I can pull the the first field i am getting, the consulting dr but it is not getting the admittingdr field or it just fills it in from the consulting field. any tips on how to get that second field?

      set Segpos [lsearch -regexp $segList {^PV1}]

               if { [lindex $Segpos 0] > 0 } {

       

                  set FldList [split [lindex $segList $Segpos] $fldSep]

                  set SubList [split [lindex $FldList $ConsultingDr] $subSep]

                  set ConsDrID [lindex $SubList $DrIDsubpos]

                  set AdmDrID [lindex $SubList $DrIDsubpos]

             

              }

    Viewing 3 reply threads
    • Author
      Replies
      • #68995

        Can you post some sample data?

        -- Max Drown (Infor)

      • #68996
        Kevin Crist
        Participant

          i am basically just pulling these 2 dr fields so i can match them against a table and kill them if they are not a match.

          Segpos: 4

          FldList: PV1 {} I 4E^404^2 9 {} {} {} {} 6484^PAVELKA^C.DANIEL^^^DO SUR {} {} {} 9 {} {} 0839^BRIDGES^JANE^M^^MD SU 1835 600 {} {} {} {} {} {} {} {} N {} {} {} {} {} {} {} {} {} {} {} A {} {} 20090831151425

          SubList: 6484 PAVELKA C.DANIEL {} {} DO

          ConsDrID: 6484

          AdmDrID:

          CONTINUE: ‘MSH|^~&|REG|GSH||GSH|20090831151732||ADT^A04|409397|T|2.3

          EVN|A04|20090831151732|||JKC^CRIST^KEVIN|20090831151732

          PID|||002076|21858|WINDU^MACE||19440404|M||B|5454 TATTOINE RD^^HILLSDALE^IN^47854|VERM||||S||9000001169|120-36-0479

          PD1||||||||||||N

          PV1||I|4E^404^2|9|||||6484^PAVELKA^C.DANIEL^^^DO|SUR||||9|||0839^BRIDGES^JANE^M^^MD|SU|1835|600|||||||||N||||||||||||A|||20090831151425

          PV2||S|HAS PURPLE LIGHTSABER|||||||||||||||||||||A||20090831

          IN1|1||803|SAGAMORE HEALTH NETWORK|PO BOX 6051^^INDIANAPOLIS^IN^46206|||||||||||WINDU^MACE|18|19440404|5454 TATTOINE RD^^HILLSDALE^IN^47854||||||||||||||||||||||||M

          IN2||120-36-0479||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||18

          ZAD

        • #68997

          Here’s some sample test code that seems to work:

          Code:

          set fldSep “|”
          set subSep “^”
          set ConsultingDr “9”
          set DrIDsubpos “17”

          set segList “PV1||I|4E^404^2|9|||||6484^PAVELKA^C.DANIEL^^^DO|SUR||||9|||0839^BRIDGES^JANE^M^^MD|SU|1835|600|||||||||N||||||||||||A|||20090831151425”

          set FldList [split [lindex $segList 0] $fldSep]
          puts “FldList: $FldListn”

          set SubList [split [lindex $FldList $ConsultingDr] $subSep]
          puts “SubList: $SubListn”

          set ConsDrID [lindex $SubList 0]
          puts “ConsDrID: $ConsDrIDn”

          set SubList [split [lindex $FldList $DrIDsubpos] $subSep]
          puts “SubList: $SubListn”

          set AdmDrID [lindex $SubList 0]
          puts “AdmDrID: $AdmDrIDn”

          -- Max Drown (Infor)

        • #68998
          Tom Rioux
          Participant

            Kevin,

            It looks as though you are missing a line in your code.  You are using the variable “$ConsultingDr” in populating the SubList.  I’m assuming that this $ConsultingDr variable is an index variable.  If so, you will also need one called something like “$AdmitDr”  I would imagine you would need something like:

            set FldList [split [lindex $segList $Segpos] $fldSep]

            set ConSubList [split [lindex $FldList $ConsultingDr] $subSep]

            set ConsDrID [lindex $ConSubList $DrIDsubpos]

            set AdmSubList [split [lindex $FldList $AdmitDr] $subSep]

            set AdmDrID [lindex $AdmSubList $DrIDsubpos]

            Sorry I’m so late in replying….I was on vacation last week.  I’m sure you got this working by now.

            Tom

        Viewing 3 reply threads
        • The forum ‘Tcl Library’ is closed to new topics and replies.