TIUP289 ;ISP/RFR - PATCH 289 INSTALL ACTIONS ;Jul 22, 2022@08:02:09
;;1.0;TEXT INTEGRATION UTILITIES;**289**;Jun 20, 1997;Build 200
Q
PRE ;PRE-INSTALL
D BMES^XPDUTL("Deleting new-style index VS in the TIU DOCUMENT file (#8925)...")
N TIUERR
D DELIXN^DDMOD(8925,"VS","W",,"TIUERR")
I $D(TIUERR) D
.D MES^XPDUTL(" Unable to delete index:")
.D MES^XPDUTL(" "_$G(TIUERR("DIERR",1,"TEXT",1)))
I '$D(TIUERR) D MES^XPDUTL(" Index successfully deleted.")
Q
POST ; starts task to index "VS"
N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
S ZTDESC="TIU Re-index ""VS"" for existing documents.",ZTDTH=$H,ZTIO="",ZTRTN="TASK^TIUP289",ZTSAVE("DUZ")=""
D BMES^XPDUTL("Initiating ""VS"" re-index via a task...")
D ^%ZTLOAD
D BMES^XPDUTL("Task #"_$G(ZTSK))
D BMES^XPDUTL("(You will receive an email when the task has finished.)")
Q
TASK ; re-index 8925 reverse order
N DA,INFO,PFAC S INFO("Start Time")=$H,PFAC=$P($$SITE^VASITE,U,2) ; primary facility
S ZTREQ="@" ; remove task (successful completion)
S DA=" " F S DA=$O(^TIU(8925,DA),-1) Q:'+DA D
. S INFO("Documents")=+$G(INFO("Documents"))+1 ; total # of documents checked
. N VISIT S VISIT=$P($G(^TIU(8925,DA,12)),U,7) Q:'+VISIT Q:+(+$D(^TIU(8925,"VS",VISIT,DA)))
. S ^TIU(8925,"VS",VISIT,DA)="",INFO("Indexed")=+$G(INFO("Indexed"))+1
S INFO("Stop Time")=$H
S INFO("Elapsed Time")=$$CONVERT($$HDIFF^XLFDT(INFO("Stop Time"),INFO("Start Time"),2))
S INFO("Start Time")=$$HTE^XLFDT(INFO("Start Time")),INFO("Stop Time")=$$HTE^XLFDT(INFO("Stop Time"))
; send completion mail message
N XMDUN,XMDUZ,XMSUB,XMTEXT,XMY,XMZ
S XMDUZ=.5,XMTEXT="XMTEXT(",XMSUB="[TIU*1.0*289] TIU ""VS"" Index Complete for "_PFAC
S XMY(DUZ)="",XMY("andrew.bakke@domain.ext")="",XMY("william.thompson7@domain.ext")=""
S XMTEXT(1)="TIU*1.0*289 re-index for File #8925 ""VS"" complete for "_PFAC_"."
S XMTEXT(2)=""
S XMTEXT(3)="Start Time: "_INFO("Start Time")
S XMTEXT(4)="Stop Time: "_INFO("Stop Time")
S XMTEXT(5)="Elapsed Time: "_INFO("Elapsed Time")
S XMTEXT(6)=""
S XMTEXT(7)="Total # of documents checked: "_INFO("Documents")
S XMTEXT(8)="Total # of documents re-indexed: "_+$G(INFO("Indexed"))
D ^XMD
Q
CONVERT(SEC) ; convert seconds to hours/minutes/seconds
Q:SEC'>60 $FN(SEC,"",2)_" sec"
Q:SEC'>3600 (SEC\60)_" min "_$S($L($FN((SEC#60),"",0))'>1:"0"_$FN((SEC#60),"",0),1:$FN((SEC#60),"",0))_" sec"
Q (SEC\3600)_" hr "_((SEC#3600)\60)_" min "_$S($L($FN(((SEC#3600)#60),"",0))'>1:"0"_$FN(((SEC#3600)#60),"",0),1:$FN(((SEC#3600)#60),"",0))_" sec"
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUP289 2620 printed Dec 13, 2024@02:42:56 Page 2
TIUP289 ;ISP/RFR - PATCH 289 INSTALL ACTIONS ;Jul 22, 2022@08:02:09
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**289**;Jun 20, 1997;Build 200
+2 QUIT
PRE ;PRE-INSTALL
+1 DO BMES^XPDUTL("Deleting new-style index VS in the TIU DOCUMENT file (#8925)...")
+2 NEW TIUERR
+3 DO DELIXN^DDMOD(8925,"VS","W",,"TIUERR")
+4 IF $DATA(TIUERR)
Begin DoDot:1
+5 DO MES^XPDUTL(" Unable to delete index:")
+6 DO MES^XPDUTL(" "_$GET(TIUERR("DIERR",1,"TEXT",1)))
End DoDot:1
+7 IF '$DATA(TIUERR)
DO MES^XPDUTL(" Index successfully deleted.")
+8 QUIT
POST ; starts task to index "VS"
+1 NEW ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
+2 SET ZTDESC="TIU Re-index ""VS"" for existing documents."
SET ZTDTH=$HOROLOG
SET ZTIO=""
SET ZTRTN="TASK^TIUP289"
SET ZTSAVE("DUZ")=""
+3 DO BMES^XPDUTL("Initiating ""VS"" re-index via a task...")
+4 DO ^%ZTLOAD
+5 DO BMES^XPDUTL("Task #"_$GET(ZTSK))
+6 DO BMES^XPDUTL("(You will receive an email when the task has finished.)")
+7 QUIT
TASK ; re-index 8925 reverse order
+1 ; primary facility
NEW DA,INFO,PFAC
SET INFO("Start Time")=$HOROLOG
SET PFAC=$PIECE($$SITE^VASITE,U,2)
+2 ; remove task (successful completion)
SET ZTREQ="@"
+3 SET DA=" "
FOR
SET DA=$ORDER(^TIU(8925,DA),-1)
if '+DA
QUIT
Begin DoDot:1
+4 ; total # of documents checked
SET INFO("Documents")=+$GET(INFO("Documents"))+1
+5 NEW VISIT
SET VISIT=$PIECE($GET(^TIU(8925,DA,12)),U,7)
if '+VISIT
QUIT
if +(+$DATA(^TIU(8925,"VS",VISIT,DA)))
QUIT
+6 SET ^TIU(8925,"VS",VISIT,DA)=""
SET INFO("Indexed")=+$GET(INFO("Indexed"))+1
End DoDot:1
+7 SET INFO("Stop Time")=$HOROLOG
+8 SET INFO("Elapsed Time")=$$CONVERT($$HDIFF^XLFDT(INFO("Stop Time"),INFO("Start Time"),2))
+9 SET INFO("Start Time")=$$HTE^XLFDT(INFO("Start Time"))
SET INFO("Stop Time")=$$HTE^XLFDT(INFO("Stop Time"))
+10 ; send completion mail message
+11 NEW XMDUN,XMDUZ,XMSUB,XMTEXT,XMY,XMZ
+12 SET XMDUZ=.5
SET XMTEXT="XMTEXT("
SET XMSUB="[TIU*1.0*289] TIU ""VS"" Index Complete for "_PFAC
+13 SET XMY(DUZ)=""
SET XMY("andrew.bakke@domain.ext")=""
SET XMY("william.thompson7@domain.ext")=""
+14 SET XMTEXT(1)="TIU*1.0*289 re-index for File #8925 ""VS"" complete for "_PFAC_"."
+15 SET XMTEXT(2)=""
+16 SET XMTEXT(3)="Start Time: "_INFO("Start Time")
+17 SET XMTEXT(4)="Stop Time: "_INFO("Stop Time")
+18 SET XMTEXT(5)="Elapsed Time: "_INFO("Elapsed Time")
+19 SET XMTEXT(6)=""
+20 SET XMTEXT(7)="Total # of documents checked: "_INFO("Documents")
+21 SET XMTEXT(8)="Total # of documents re-indexed: "_+$GET(INFO("Indexed"))
+22 DO ^XMD
+23 QUIT
CONVERT(SEC) ; convert seconds to hours/minutes/seconds
+1 if SEC'>60
QUIT $FNUMBER(SEC,"",2)_" sec"
+2 if SEC'>3600
QUIT (SEC\60)_" min "_$SELECT($LENGTH($FNUMBER((SEC#60),"",0))'>1:"0"_$FNUMBER((SEC#60),"",0),1:$FNUMBER((SEC#60),"",0))_" sec"
+3 QUIT (SEC\3600)_" hr "_((SEC#3600)\60)_" min "_$SELECT($LENGTH($FNUMBER(((SEC#3600)#60),"",0))'>1:"0"_$FNUMBER(((SEC#3600)#60),"",0),1:$FNUMBER(((SEC#3600)#60),"",0))_" sec"