sorting obx segments

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf sorting obx segments

  • Creator
    Topic
  • #51299
    Mason Miller
    Participant

      I have a tps proc that is sorting the obx segments but I have an issue when there is not a obx segment I am thinking I shoud be able to do this with an if statement but I am not having any luck any ideas?

      here is my code

      Code:

       
                  set mh [keylget args MSGID]

        set msg [msgget $mh]
        set fld_sep [string index $msg 3]
        set segs [split $msg r]
        set obx_segs [lsearch -inline -all $segs {OBX*}]
        set obx_nums [lsearch -all $segs {OBX*}]
        set z 0
           
        foreach line $obx_segs {
           set line2 [split $line $fld_sep]
           set obx1 [lindex $line2 1]
           incr z
           if {$obx1 == $z} {lappend obx_segs2 [split $line $fld_sep] }
      #puts $obx1  
      #puts $z}  
      #puts $obx_segs2

       
        # sort with OBX.3 as the key
        set obx_segs2 [lsort -index 3 $obx_segs2]  
        for { set i 0 } { $i < [llength $obx_segs2] } { incr i } {         set j [lindex $obx_nums $i]             set segs [lreplace $segs $j $j [join [lindex $obx_segs2 $i] $fld_sep]] }   msgset $mh [join $segs r]           lappend dispList "CONTINUE $mh"

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