Pulling multiple Dr# from same field

Clovertech Forums Read Only Archives Cloverleaf Tcl Library Pulling multiple Dr# from same field

  • Creator
    Topic
  • #51351
    Kevin Crist
    Participant

      I am trying to pull the dr numbers from all dr fields and and comparing them to a table to kill or continue. How do i pull the number from a dr field if their are multiple drs seperated by the ~. Below is my code.

      switch -exact [lindex $fldList 0] {

        PD1 {

            if { [llength $fldList] >= [expr $PrimaryPos + 1] } {

            set repList [split [lindex $fldList $PrimaryPos] $repSep]

                 set value  [split [lindex $repList 0] $subSep]            

      set PrimaryPosVal [tbllookup $table $PrimaryPos]

      But when i do the echo on my replist i get 9999^BILL^COSBY^^^MD 1111^MARLEY^BOB^^^MD, which is want (i think), so when i split it out again i get the 9999 BILL COSBY {} {} MD, but not the second dr. How would i get the second dr and then pull out the number? Any help is appreciated.

    Viewing 0 reply threads
    • Author
      Replies
      • #69835
        Jim Levy
        Participant

          Hi Kevin,

          Here’s what I came up with.  I didn’t test it, but it should be close to right.

          switch -exact [lindex $fldList 0] {

           PD1 {

               if { [llength $fldList] >= [expr $PrimaryPos + 1] } {

               set repList [split [lindex $fldList $PrimaryPos] $repSep]

               foreach rep $repList {

                    set value [lindex [split $rep $subSep] 0]

                    set PrimaryPosVal[tbllookup $table $value]      

                    # What you do next depends on whether you want to kill

                    # the doc out of the list or kill/continue the record.    

               }

          I am wondering why you are calling  your value returned from the table “PrimaryPosVal”.

             

          If you provide more information I’ll be happy to try to help.

          Jim

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