null out field after a pathcopy

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf null out field after a pathcopy

  • Creator
    Topic
  • #50322
    Gary Atkinson
    Participant

      I have vendor (I could tell how I fell, but this is a rated G forum  ðŸ˜ˆ ) that is complaining that on an occasssion the DR id sub-field in the attending dr field PV1:7 is too long.  They state they can only have 20 or less characters.  So, I wrote a little tclproc to check for this:

      Code:


      set drid [ lindex $xlateInVals 0 ]
      puts “Inval: $drid”
      set drid_len [ string length $drid ]
      if {$drid_len >= 20} {
      set xlateOutVals {}
      } else {
      set xlateOutVals [ lindex $xlateInVals 0 ]
      }
      puts “outval: $xlateOutVals”

      When I test this the Dr id field is outputed even if it is greater than on equal to 20.

      Now the PV1 field is a pathcopy (I did built this someone else did  ðŸ˜¯ ) and I am doing a copy right after with PV1:7[0]; I think that is where the problem is.  Here is an example output from the tester tool:

      Code:


      Inval: THISISATESTFORLONG, NAMES
      outval:
      MESSAGE 1
      0(0).MSH(0).00001(0) “Field Separator” : >|< 0(0).MSH(0).00002(0) "Encoding Characters" : >^~&< 0(0).MSH(0).00003(0) "Sending Application" : >NAHM< 0(0).MSH(0).00004(0) "Sending Facility" : >BWMC< 0(0).MSH(0).00005(0) "Receiving Application" : >FUJI< 0(0).MSH(0).00006(0) "Receiving Facility" : >BWMC< 0(0).MSH(0).00007(0) "Date/Time of Message" : >20080926112850< 0(0).MSH(0).00009(0) "Message Type" : >ORM^O01< 0(0).MSH(0).00010(0) "Message Control ID" : >Q24944809T16949600< 0(0).MSH(0).00011(0) "Processing ID" : >P< 0(0).MSH(0).00012(0) "Version ID" : >2.3< 0(0).MSH(0).00015(0) "Accept Acknowledgment Type" : >AL< 1(0).0(0).PID(0).00104(0) "Set ID - PID" : >1< 1(0).0(0).PID(0).00105(0) "Patient ID (External ID)" : >1012867< 1(0).0(0).PID(0).00106(0) "Patient ID (Internal ID)" : >1012867< 1(0).0(0).PID(0).00108(0) "Patient Name" : >CONTROL^PRECISION< 1(0).0(0).PID(0).00110(0) "Date/Time of Birth" : >19800119< 1(0).0(0).PID(0).00111(0) "Sex" : >M< 1(0).0(0).PID(0).00112(0) "Patient Alias" : >CONTROL^PRECISION^^JR< 1(0).0(0).PID(0).00113(0) "Race" : >5< 1(0).0(0).PID(0).00114(0) "Patient Address" : >1215 CHAOS COURT^^HALETHORPE^MD^21227^US^^^03< 1(0).0(0).PID(0).00115(0) "County Code" : >03< 1(0).0(0).PID(0).00116(0) "Phone Number - Home" : >(410)567-8965< 1(0).0(0).PID(0).00117(0) "Phone Number - Business" : >NONE< 1(0).0(0).PID(0).00118(0) "Primary Language" : >E< 1(0).0(0).PID(0).00119(0) "Marital Status" : >S< 1(0).0(0).PID(0).00121(0) "Patient Account Number" : >827000001< 1(0).0(0).PID(0).00122(0) "SSN Number - Patient" : >639852147< 1(0).1(0).0(0).PV1(0).00131(0) "Set ID - PV1" : >1< 1(0).1(0).0(0).PV1(0).00132(0) "Patient Class" : >O< 1(0).1(0).0(0).PV1(0).00133(0) "Assigned Patient Location" : >RAD^^^BWMC^^^NAH< 1(0).1(0).0(0).PV1(0).00134(0) "Admission Type" : >Elective< 1(0).1(0).0(0).PV1(0).00137(0) "Attending Doctor" : >THISISATESTFORLONG, NAMES^THISISATESTFORLONG, NAMES< 1(0).1(0).0(0).PV1(0).00140(0) "Hospital Service" : >RAD< 1(0).1(0).0(0).PV1(0).00144(0) "Admit Source" : >*Ph< [b]1(0).1(0).0(0).PV1(0).00147(0) "Admitting Doctor" : >THISISATESTFORLONG, NAMES^THISISATESTFORLONG, NAMES<[/b] 1(0).1(0).0(0).PV1(0).00148(0) "Patient Type" : >OP< 1(0).1(0).0(0).PV1(0).00149(0) "Visit Number" : >827000001< 1(0).1(0).0(0).PV1(0).00150(0) "Financial Class" : >S< 1(0).1(0).0(0).PV1(0).00169(0) "Servicing Facility" : >BW< 1(0).1(0).0(0).PV1(0).00174(0) "Admit Date/Time" : >20080926110600< 2(0).0(0).ORC(0).00215(0) "Order Control" : >NW< 2(0).0(0).ORC(0).00216(0) "Placer Order Number" : >XR-08-0000591< 2(0).0(0).ORC(0).00219(0) "Order Status" : >Exam Completed< 2(0).0(0).ORC(0).00223(0) "Date/Time of Transaction" : >20080926112500< 2(0).0(0).ORC(0).00224(0) "Entered By" : >^Costanzo^Jennifer< 2(0).0(0).ORC(0).00226(0) "Ordering Provider" : >152^Gorbaty, M.D.^Elliott< 2(0).0(0).ORC(0).00226(1) "Ordering Provider" : >152^Gorbaty, M.D.^Elliott< 2(0).0(0).ORC(0).00229(0) "Order Effective Date/Time" : >20080926112850< 2(0).0(0).ORC(0).00232(0) "Entering Device" : >Written^Written< 2(0).0(0).ORC(0).00233(0) "Action By" : >^Costanzo^Jennifer< 2(0).1(0).0(0).OBR(0).00237(0) "Set ID - OBR" : >1< 2(0).1(0).0(0).OBR(0).00216(0) "Placer Order Number" : >XR-08-0000591< 2(0).1(0).0(0).OBR(0).00238(0) "Universal Service Identifier" : >7001^XR Abdomen AP< 2(0).1(0).0(0).OBR(0).00241(0) "Observation Date/Time" : >20080926112850< 2(0).1(0).0(0).OBR(0).00242(0) "Observation End Date/Time" : >20080926112850< 2(0).1(0).0(0).OBR(0).00226(0) "Ordering Provider" : >152^Gorbaty, M.D.^Elliott< 2(0).1(0).0(0).OBR(0).00226(1) "Ordering Provider" : >152^Gorbaty, M.D.^Elliott< 2(0).1(0).0(0).OBR(0).00250(0) "Order Callback Phone Number" : >(410)7874000< 2(0).1(0).0(0).OBR(0).00253(0) "Filler Field 1" : >21442121< 2(0).1(0).0(0).OBR(0).00255(0) "Results Rpt/Status Chng - Date/Time" : >20080926112850< 2(0).1(0).0(0).OBR(0).00257(0) "Diagnostic Serv Sect ID" : >CR< 2(0).1(0).0(0).OBR(0).00221(0) "Quantity/Timing" : >1^^0^20080926112600^^R< 2(0).1(0).0(0).OBR(0).00263(0) "Reason For Study" : >^Abdominal Aneurysm w/o rupture<

      Why does xlateOutVals ouput a null, but in the message the long name appears??[/b]

    Viewing 4 reply threads
    • Author
      Replies
      • #65633
        Gary Atkinson
        Participant

          Well I think I got it  ðŸ˜¯

          I used a temp variable and checked with an IF statement.  But, if someone could tell why my tcl proc didn’t work I would be ever so grateful  8)

        • #65634
          Mike Grieger
          Participant

            I think if your xlateOutVals line were modified to treat as a list, it would work…

            if {$drid_len >= 20} {

            set xlateOutVals {}

            TO:

            if {$drid_len >= 20} {

            set xlateOutVals

          • #65635
            Tom Rioux
            Participant

              The pathcopy copies everything over to that field.  So, to get rid of that, you will need to copy an active null over to that field.  To do that, simply change your first xlateOutVals from:

              set xlateOutVals {}

              to this:

              set xlateOutVals “”

              This should null out your first field and get you the results you desire.  I’ve tested it on 5.6 and it works like a charm.  This will also prevent you from having an extra line in your xlate to set something to a variable.

              Hope this helps…

              Tom Rioux

              Baylor Health Care

            • #65636
              John Mercogliano
              Participant

                Gary,

                  Your problem is set xlateOutVals {}. This sets the variable to an empty string.  Always remember when working with the xlateIn/OutVals variables always treat them as a list.  Otherwise you will eventually get unexpected results.

                  You can see the difference from the hcitcl command prompt.

                Code:


                hcitcl>set xlateOutVals {}
                hcitcl>set xlateOutVals
                hcitcl>set xlateOutVals [list {}]
                hcitcl>set xlateOutVals
                {}

                Hope this helps,

                John Mercogliano
                Sentara Healthcare
                Hampton Roads, VA

              • #65637
                Gary Atkinson
                Participant

                  Thanks all!

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