removing IN1 & IN2 segments

Homepage Clovertech Forums Read Only Archives Cloverleaf Tcl Library removing IN1 & IN2 segments

  • Creator
    Topic
  • #54643
    Kevin Crist
    Participant

    I need to remove the IN1 & IN2 segment IF PV1.3 = CCC and IN1.3 = 167. I’m told that it will always be the first IN1 set but i have little faith that that will always be the case so i am wanting to search all of them and not sure how to do this and remove the segments as well.

    Below is what i have so far.

    Code:

    #########################################################################################

    proc tpsRemoveInsForFoundationRad { args } {

    #########################################################################################
    # Get the Connection/Proc Name for Error/Debug Messages (NOT USED)
    #########################################################################################

    # global HciConnName
    # set myname “$HciConnName/[lindex [info level 1] 0]”
    # set nowis [clock format [clock scan now] -format “%D – %T”]

    #########################################################################################
    # Initialize Variables Used
    #########################################################################################

    set dispList [list]   ;# Disposition List Returned to Engine

    set fldSep “” ;# Field Seperator – get from MSH
    set subSep “” ;# SubField Seperator – get from MSH
    set repSep “” ;# Repeating Field Seperator – get from MSH

    set PV1pos -1 ;# Position of PV1 Segment in msg
    set PV1List [list] ;# PV1 Segment Fields in List Form
    set PV1PatLocation 3  ;# Patient Location is in PV1.3  
           
    set IN1pos -1 ;# Position of IN1 segment
    set IN1List [list] ;# IN1 Segment Fields in List Form
    set IN1CompID 3 ;# ID of Insurance Company            
           
    #########################################################################################
    # Load in the arguments we need that were passed from the caller
    #########################################################################################

    keylget args MODE mode             ;# The mode the engine called from
    set echoon “NO” ;# Set to default Value
    keylget args ARGS.ECHOON echoon ;# The Engine Log output indicator
    set echoon [string toupper $echoon] ;# Use upper case in procedure

    #########################################################################################
    # Switch based on what mode the engine was in when it called the procedure
    #########################################################################################

     switch -exact — $mode {

      start { }

       run {
        set mh [keylget args MSGID] ;# Get message handle from args
         set dispList [list “CONTINUE $mh”] ;# Initialize to good message
         set msg [msgget $mh] ;# Get a copy of the message

         set fldSep [string index $msg 3] ;# Field Seperator
         set subSep [string index $msg 4] ;# Sub-Field Seperator
         set repSep [string index $msg 5] ;# Repeating Field Seperator

    set segList [split $msg r] ;# Split message into segList

    #########################################################################################
    # Find Position of Segements – If missing -> Error out Message and Return
    #########################################################################################

    set PV1pos [lsearch -regexp $segList {^PV1}]  
    set IN1pos [lsearch -regexp $segList {^IN1}]

    #########################################################################################
    # Split up the Segments into Field Lists
    #########################################################################################

     set PV1List [split [lindex $segList $PV1pos] $fldSep]  
    set IN1List [split [lindex $segList $IN1pos] $fldSep]

    #########################################################################################
    #
    #########################################################################################

    set pat_location [lindex [split [lindex $PV1List $PV1PatLocation] $subSep] 0]
     set ins_company_loc [lindex $IN1List $IN1CompID]

    #########################################################################################
    # If the PV1 = CCC and IN1.3 = 167 then remove instance of Insurance
    #
    #########################################################################################

       if {[string equal $pat_location CCC] && [string equal $ins_company_loc 167] } {

     
         
       }  
       
    }

       time { }
       shutdown { }
    } ;# End Switch

    return $dispList

    } ;# End Proc

Viewing 0 reply threads
  • Author
    Replies
    • #82392
      Jim Kosloskey
      Participant

      If you have an Xlate this is is rather eassy to do there.

      Unless you have BULKCOPY – then it gets a little more work but not any more difficult.

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

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

Forum Statistics

Registered Users
5,129
Forums
28
Topics
9,301
Replies
34,448
Topic Tags
288
Empty Topic Tags
10