INHMS4 ;JSH,DJL; 24 Jan 95 14:03;Interface - Message Search
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
;
GATHER(INSRCH,INDA,IND,INRVSRCH) ; Collect search criteria data
; MODULE NAME: GATHER ( Search Criteria Gathering Routine )
; DESCRIPTION: Gather the list of user selected search criteria and
; manipulate IND search starting variable depending on
; the INVRSRCH flag setting. Notify the user if the
; search may span a large numbe of messages and give
; the option of discontinuing the search
; RETURN = none
; PARAMETERS:
; INSRCH = Array for holding search criteria information
; INDA = Unique IEN into ^INTHU(4001.1) where ^DWC puts the
; user entered search criteria information
; IND = The starting time/date of the search set from information
; in INSRCH and determined by INRVSRCH flag
; INRVSRCH = Flag set user indicating direction of the search
; -1 = (default)a reverse listing order. Newest to Oldest
; 1 = a forward search listing order. Oldest to Newest
; CODE BEGINS
N X,INSRCHST,INSRCHEN,INNODE,INTEMP
S INNODE=1
F X="INSTART","INDEST","INSTAT","INID","INSOURCE","INDIR","INORIG","INPAT","INTEMP","INTYPE","INORDER","INEXPAND" S INSRCH(X)=$G(^DIZ(4001.1,INDA,INNODE)),INNODE=INNODE+1
S INSRCH("INEND")=$G(^DIZ(4001.1,INDA,1.1))
I $D(^DIZ(4001.1,INDA,9,0)) S INNODE=0 F S INNODE=$O(^DIZ(4001.1,INDA,9,INNODE)) Q:'INNODE S INSRCH("INTEXT")=INNODE,INSRCH("INTEXT",INNODE)=^DIZ(4001.1,INDA,9,INNODE,0)
S:'INSRCH("INEND")!(INSRCH("INEND")=DT) (INSRCH("INEND"),^DIZ(4001.1,INDA,1.1))=DT_".24"
I (INSRCH("INEND")-INSRCH("INSTART"))<0 D
. ; a RECENT to PAST search criteria
. S:(INSRCH("INEND")\1=INSRCH("INEND")) INSRCH("INEND")=INSRCH("INEND")-.0000001
. S INTEMP=INSRCH("INSTART"),INSRCH("INSTART")=INSRCH("INEND")
. I (INTEMP\1)=INTEMP S INSRCH("INEND")=INTEMP+.999999
. I (INTEMP\1)'=INTEMP S INSRCH("INEND")=INTEMP
E D
. ; a PAST to RECENT search criteria
. I (INSRCH("INEND")\1=INSRCH("INEND")) S INSRCH("INEND")=INSRCH("INEND")+.999999
. E S INSRCH("INEND")=INSRCH("INEND")+.000099 ; Because second resolution can not be entered
. S INSRCH("INSTART")=INSRCH("INSTART")-.0000001
; set the search string match type (AND/OR)
S:($D(INSRCH("INTEXT"))>9)&('INSRCH("INTYPE")) (INSRCH("INTYPE"),^DIZ(4001.1,INDA,10))=0
; set the search starting point, (listing direction dependent)
S:'$G(INSRCH("INORDER")) (INSRCH("INORDER"),^DIZ(4001.1,INDA,11))=0
S IND=$S('INSRCH("INORDER"):INSRCH("INEND"),1:INSRCH("INSTART"))
S INRVSRCH=$S('INSRCH("INORDER"):-1,1:1)
Q
;
SRCHSIZE(INSRCH) ; Determine the expected search size
; MODULE NAME: SRCHSIZE ( Determine the expected Search Size )
; DESCRIPTION: Determine the expected number of message that will
; be searched. Warn of very large searches and provide
; a mechanism to abort the search.
; Uses the Start-Date and End-Date of span to search to
; determine the size(approximate).
; RETURNS: -1 = The user aborted the search
; Number of messages in the search
; PARAMETERS:
; INSRCH = Array for holding search criteria information
; CODE BEGINS
N INSRCHEN,INSRCHST,INTEMP,INMSGCT,INSIZE,INWRNSZ
; INWRNSZ= the water-mark on when to notify the user of the search size
S INWRNSZ=5000,INSIZE=0,INTEMP=$O(^INTHU("B",INSRCH("INSTART")))
I INTEMP,(INTEMP<INSRCH("INEND")) S INSRCHST=$O(^INTHU("B",INTEMP,"")),INTEMP=$O(^INTHU("B",INSRCH("INEND")),-1),INSRCHEN=$O(^INTHU("B",INTEMP,""),-1),(INMSGCT,INSIZE)=(INSRCHEN-INSRCHST)+1
I INTEMP,(INTEMP<INSRCH("INEND")),(INMSGCT>INWRNSZ) D
. W !! D ERR^INHMS2("WARNING: Approximate search size="_INMSGCT_" messages. This may take awhile.")
. I '$$YN^UTSRD("Do you want to continue with THIS search? ") S INSIZE=-1
Q INSIZE
;
INHMS4 ;JSH,DJL; 24 Jan 95 14:03;Interface - Message Search
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
+3 ;
GATHER(INSRCH,INDA,IND,INRVSRCH) ; Collect search criteria data
+1 ; MODULE NAME: GATHER ( Search Criteria Gathering Routine )
+2 ; DESCRIPTION: Gather the list of user selected search criteria and
+3 ; manipulate IND search starting variable depending on
+4 ; the INVRSRCH flag setting. Notify the user if the
+5 ; search may span a large numbe of messages and give
+6 ; the option of discontinuing the search
+7 ; RETURN = none
+8 ; PARAMETERS:
+9 ; INSRCH = Array for holding search criteria information
+10 ; INDA = Unique IEN into ^INTHU(4001.1) where ^DWC puts the
+11 ; user entered search criteria information
+12 ; IND = The starting time/date of the search set from information
+13 ; in INSRCH and determined by INRVSRCH flag
+14 ; INRVSRCH = Flag set user indicating direction of the search
+15 ; -1 = (default)a reverse listing order. Newest to Oldest
+16 ; 1 = a forward search listing order. Oldest to Newest
+17 ; CODE BEGINS
+18 NEW X,INSRCHST,INSRCHEN,INNODE,INTEMP
+19 SET INNODE=1
+20 FOR X="INSTART","INDEST","INSTAT","INID","INSOURCE","INDIR","INORIG","INPAT","INTEMP","INTYPE","INORDER","INEXPAND"
SET INSRCH(X)=$GET(^DIZ(4001.1,INDA,INNODE))
SET INNODE=INNODE+1
+21 SET INSRCH("INEND")=$GET(^DIZ(4001.1,INDA,1.1))
+22 IF $DATA(^DIZ(4001.1,INDA,9,0))
SET INNODE=0
FOR
SET INNODE=$ORDER(^DIZ(4001.1,INDA,9,INNODE))
IF 'INNODE
QUIT
SET INSRCH("INTEXT")=INNODE
SET INSRCH("INTEXT",INNODE)=^DIZ(4001.1,INDA,9,INNODE,0)
+23 IF 'INSRCH("INEND")!(INSRCH("INEND")=DT)
SET (INSRCH("INEND"),^DIZ(4001.1,INDA,1.1))=DT_".24"
+24 IF (INSRCH("INEND")-INSRCH("INSTART"))<0
Begin DoDot:1
+25 ; a RECENT to PAST search criteria
+26 IF (INSRCH("INEND")\1=INSRCH("INEND"))
SET INSRCH("INEND")=INSRCH("INEND")-.0000001
+27 SET INTEMP=INSRCH("INSTART")
SET INSRCH("INSTART")=INSRCH("INEND")
+28 IF (INTEMP\1)=INTEMP
SET INSRCH("INEND")=INTEMP+.999999
+29 IF (INTEMP\1)'=INTEMP
SET INSRCH("INEND")=INTEMP
End DoDot:1
+30 IF '$TEST
Begin DoDot:1
+31 ; a PAST to RECENT search criteria
+32 IF (INSRCH("INEND")\1=INSRCH("INEND"))
SET INSRCH("INEND")=INSRCH("INEND")+.999999
+33 ; Because second resolution can not be entered
IF '$TEST
SET INSRCH("INEND")=INSRCH("INEND")+.000099
+34 SET INSRCH("INSTART")=INSRCH("INSTART")-.0000001
End DoDot:1
+35 ; set the search string match type (AND/OR)
+36 IF ($DATA(INSRCH("INTEXT"))>9)&('INSRCH("INTYPE"))
SET (INSRCH("INTYPE"),^DIZ(4001.1,INDA,10))=0
+37 ; set the search starting point, (listing direction dependent)
+38 IF '$GET(INSRCH("INORDER"))
SET (INSRCH("INORDER"),^DIZ(4001.1,INDA,11))=0
+39 SET IND=$SELECT('INSRCH("INORDER"):INSRCH("INEND"),1:INSRCH("INSTART"))
+40 SET INRVSRCH=$SELECT('INSRCH("INORDER"):-1,1:1)
+41 QUIT
+42 ;
SRCHSIZE(INSRCH) ; Determine the expected search size
+1 ; MODULE NAME: SRCHSIZE ( Determine the expected Search Size )
+2 ; DESCRIPTION: Determine the expected number of message that will
+3 ; be searched. Warn of very large searches and provide
+4 ; a mechanism to abort the search.
+5 ; Uses the Start-Date and End-Date of span to search to
+6 ; determine the size(approximate).
+7 ; RETURNS: -1 = The user aborted the search
+8 ; Number of messages in the search
+9 ; PARAMETERS:
+10 ; INSRCH = Array for holding search criteria information
+11 ; CODE BEGINS
+12 NEW INSRCHEN,INSRCHST,INTEMP,INMSGCT,INSIZE,INWRNSZ
+13 ; INWRNSZ= the water-mark on when to notify the user of the search size
+14 SET INWRNSZ=5000
SET INSIZE=0
SET INTEMP=$ORDER(^INTHU("B",INSRCH("INSTART")))
+15 IF INTEMP
IF (INTEMP<INSRCH("INEND"))
SET INSRCHST=$ORDER(^INTHU("B",INTEMP,""))
SET INTEMP=$ORDER(^INTHU("B",INSRCH("INEND")),-1)
SET INSRCHEN=$ORDER(^INTHU("B",INTEMP,""),-1)
SET (INMSGCT,INSIZE)=(INSRCHEN-INSRCHST)+1
+16 IF INTEMP
IF (INTEMP<INSRCH("INEND"))
IF (INMSGCT>INWRNSZ)
Begin DoDot:1
+17 WRITE !!
DO ERR^INHMS2("WARNING: Approximate search size="_INMSGCT_" messages. This may take awhile.")
+18 IF '$$YN^UTSRD("Do you want to continue with THIS search? ")
SET INSIZE=-1
End DoDot:1
+19 QUIT INSIZE
+20 ;