ATSERCH9 ;TUCSON/DG;MENU FOR CHOICES TO LINK TO [ 10/25/91 1:40 PM ]
;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
;
F ATSENB=1:1:3 S ATSEOP(ATSENB)=$P($T(OPTIONS+ATSENB),";",3)
I ($D(ATSNPT)&(ATSNOT=""))!(ATSEARCH(1,"SRCHRESLTREF")=ATSEARCH(2,"SRCHRESLTREF")) D PTRONLY,EOJ Q
I ATSEARCH("PTRFILENUM")=ATSEARCH(2,"SRCHFILENUM")!(ATSEARCH("PTRFILENUM")=ATSEARCH(1,"SRCHFILENUM")) D ASKFILE,EOJ Q
I ATSEARCH(1,"SRCHFILENUM")=ATSEARCH(2,"SRCHFILENUM"),ATSEARCH(1,"FIELD")=.01,ATSEARCH(1,"SECONDPCE")["P" D ASKFILE3,EOJ Q ;.01 FIELD IS A POINTER
I ATSEARCH(1,"SRCHFILENUM")=ATSEARCH(2,"SRCHFILENUM") D ASKFILE3,EOJ Q
D @$S(ATSNOT="":"ASKFILE4",1:"ASKFILE5^ATSERCHH"),EOJ Q ;IF TWO TEMPLATES LINKED TO DIFFERENT FILES
;
ASKFILE ;PTRFILE=SRCHFILE1 OR SRCHFILE2
S X="" F ATSL=0:0 Q:X=1!(X=2)!(X="^")!(ATSFLAG) D:X["?" HELP D @$S(ATSNOT="":"ASKLOOP",1:"ASKLOOP2")
I ATSFLAG Q
S ATSEARCH("FILELINK")=ATSEARCH(X,"SRCHFILENUM"),ATSX=X
D ^ATSERCH4
Q
;
ASKLOOP ;CONTINUATION OF FOR LOOP IN ASKFILE IF INTERSECTION OF TEMPLATES
I ATSEARCH("PTRFILENUM")=ATSEARCH(1,"SRCHFILENUM") S ATSEY=1
E S ATSEY=2
W !!,"Choose, by number, the file you want merged results linked to:",!!,1," ",@ATSEOP(1),!,2," ",@ATSEOP(2) W !!,"Your choice (1 or 2): ",ATSEY,"// " R X:DTIME
S:X=""&($T) X=ATSEY S:'$T X="^" I "^"=X S ATSFLAG=$S($D(^UTILITY("ATSEARCH",$J,"MERGED")):2,1:1)
Q
;
ASKLOOP2 ;PTRFILE=SRCHFILE1 OR SRCHFILE2, DIFFERENCE BETWEEN TEMPLATES
W !!,"Results will be linked with the ",@$S(ATSMTCH=2:ATSEOP(1),1:ATSEOP(2))_" file" H 2
S X=$S(ATSMTCH=2:1,1:2)
;
;IF MATCH=2 THEN CAN ONLY LINK TO TEMPLATE 1
;IF MATCH=3 THEN CAN ONLY LINK TO TEMPLATE 2
;
Q
;
PTRONLY ;LINKS ONLY TO PTRFILE IF TEMPLATES LINKED TO SAME FILE
S ATSEARCH("FILELINK")=ATSEARCH("PTRFILENUM")
W !!,"Results will be linked with the ",ATSEARCH("PTRFILENAM")," file" H 2
D ^ATSERCH4
Q
;
ASKFILE3 ;SRCHFILE1=SRCHFILE2, IF DIFFERENCE, THEN UTILIZE THE TEMPLATE THAT
;HAS THE ENTRIES YOU WILL STORE TO CREATE THE "MERGED" UTILITY NODES
S X="" F ATSL=0:0 Q:X=1!(X=2)!(X="^")!(ATSFLAG) D:X["?" HELP D ASKLOOP3
I ATSFLAG Q
S ATSENB=$S(ATSMTCH=3:2,1:1) ; IF ATSMTCH=3 THEN USE TEMPLATE TWO
S ATSEARCH("FILELINK")=$S(X=1:ATSEARCH(1,"SRCHFILENUM"),1:ATSEARCH("PTRFILENUM"))
;FOR FILELINK, ATSEARCH(1,"SRCHFILENUM")=(2,"SRCHFILENUM")
S ATSX=ATSENB
;ATSX IS USEFUL ONLY IF USER WANTS RESULTS NOT LINKED TO PTR FILE
D ^ATSERCH4
Q
;
ASKLOOP3 ;CONTINUATION OF FOR LOOP IN ASKFILE3
W !!,"Choose, by number, the file you want results linked to:",!!,1," ",@ATSEOP(1),!,2," ",@ATSEOP(3) R !!,"Your choice (1 or 2): 2// ",X:DTIME
S:X=""&($T) X=2 S:'$T X="^" I "^"=X S ATSFLAG=$S($D(^UTILITY("ATSEARCH",$J,"MERGED")):2,1:1)
Q
;
ASKFILE4 ;PTRFILE,SRCHFILE1,SRCHFILE2 DIFF FILES, INTERSECTION OF TEMPLATES
S X="" F ATSL=0:0 Q:(X'<1&(X'>3))!(X="^")!(ATSFLAG) D:X["?" HELP D ASKLOOP4
I ATSFLAG Q
S ATSEARCH("FILELINK")=$S(X=1:ATSEARCH(1,"SRCHFILENUM"),X=2:ATSEARCH(2,"SRCHFILENUM"),1:ATSEARCH("PTRFILENUM")),ATSX=X
D ^ATSERCH4
Q
;
ASKLOOP4 ;CONTINUATION OF FOR LOOP IN ASKFILE4
W !!,"Choose, by number, the file you want merged results linked to:",!!,1," ",@ATSEOP(1),!,2," ",@ATSEOP(2),!,3," ",@ATSEOP(3) R !!,"Your choice (1-3): 3// ",X:DTIME
S:X=""&($T) X=3 S:'$T X="^" I "^"=X S ATSFLAG=$S($D(^UTILITY("ATSEARCH",$J,"MERGED")):2,1:1)
Q
;
HELP ; - EP - CALL TO HELP FRAME
S XQH="ATSEARCH-LINK",DIC(0)="X" D EN^XQH
W:$D(IOF) @IOF
Q
;
EOJ ;
K ATSEOP,ATSENB,ATSEY,ATSNPT
Q
;
OPTIONS ;MENU CHOICES
;;ATSEARCH(1,"SRCHFILENAM")
;;ATSEARCH(2,"SRCHFILENAM")
;;ATSEARCH("PTRFILENAM")
;;
ATSERCH9 ;TUCSON/DG;MENU FOR CHOICES TO LINK TO [ 10/25/91 1:40 PM ]
+1 ;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
+2 ;
+3 FOR ATSENB=1:1:3
SET ATSEOP(ATSENB)=$PIECE($TEXT(OPTIONS+ATSENB),";",3)
+4 IF ($DATA(ATSNPT)&(ATSNOT=""))!(ATSEARCH(1,"SRCHRESLTREF")=ATSEARCH(2,"SRCHRESLTREF"))
DO PTRONLY
DO EOJ
QUIT
+5 IF ATSEARCH("PTRFILENUM")=ATSEARCH(2,"SRCHFILENUM")!(ATSEARCH("PTRFILENUM")=ATSEARCH(1,"SRCHFILENUM"))
DO ASKFILE
DO EOJ
QUIT
+6 ;.01 FIELD IS A POINTER
IF ATSEARCH(1,"SRCHFILENUM")=ATSEARCH(2,"SRCHFILENUM")
IF ATSEARCH(1,"FIELD")=.01
IF ATSEARCH(1,"SECONDPCE")["P"
DO ASKFILE3
DO EOJ
QUIT
+7 IF ATSEARCH(1,"SRCHFILENUM")=ATSEARCH(2,"SRCHFILENUM")
DO ASKFILE3
DO EOJ
QUIT
+8 ;IF TWO TEMPLATES LINKED TO DIFFERENT FILES
DO @$SELECT(ATSNOT="":"ASKFILE4",1:"ASKFILE5^ATSERCHH")
DO EOJ
QUIT
+9 ;
ASKFILE ;PTRFILE=SRCHFILE1 OR SRCHFILE2
+1 SET X=""
FOR ATSL=0:0
IF X=1!(X=2)!(X="^")!(ATSFLAG)
QUIT
IF X["?"
DO HELP
DO @$SELECT(ATSNOT="":"ASKLOOP",1:"ASKLOOP2")
+2 IF ATSFLAG
QUIT
+3 SET ATSEARCH("FILELINK")=ATSEARCH(X,"SRCHFILENUM")
SET ATSX=X
+4 DO ^ATSERCH4
+5 QUIT
+6 ;
ASKLOOP ;CONTINUATION OF FOR LOOP IN ASKFILE IF INTERSECTION OF TEMPLATES
+1 IF ATSEARCH("PTRFILENUM")=ATSEARCH(1,"SRCHFILENUM")
SET ATSEY=1
+2 IF '$TEST
SET ATSEY=2
+3 WRITE !!,"Choose, by number, the file you want merged results linked to:",!!,1," ",@ATSEOP(1),!,2," ",@ATSEOP(2)
WRITE !!,"Your choice (1 or 2): ",ATSEY,"// "
READ X:DTIME
+4 IF X=""&($TEST)
SET X=ATSEY
IF '$TEST
SET X="^"
IF "^"=X
SET ATSFLAG=$SELECT($DATA(^UTILITY("ATSEARCH",$JOB,"MERGED")):2,1:1)
+5 QUIT
+6 ;
ASKLOOP2 ;PTRFILE=SRCHFILE1 OR SRCHFILE2, DIFFERENCE BETWEEN TEMPLATES
+1 WRITE !!,"Results will be linked with the ",@$SELECT(ATSMTCH=2:ATSEOP(1),1:ATSEOP(2))_" file"
HANG 2
+2 SET X=$SELECT(ATSMTCH=2:1,1:2)
+3 ;
+4 ;IF MATCH=2 THEN CAN ONLY LINK TO TEMPLATE 1
+5 ;IF MATCH=3 THEN CAN ONLY LINK TO TEMPLATE 2
+6 ;
+7 QUIT
+8 ;
PTRONLY ;LINKS ONLY TO PTRFILE IF TEMPLATES LINKED TO SAME FILE
+1 SET ATSEARCH("FILELINK")=ATSEARCH("PTRFILENUM")
+2 WRITE !!,"Results will be linked with the ",ATSEARCH("PTRFILENAM")," file"
HANG 2
+3 DO ^ATSERCH4
+4 QUIT
+5 ;
ASKFILE3 ;SRCHFILE1=SRCHFILE2, IF DIFFERENCE, THEN UTILIZE THE TEMPLATE THAT
+1 ;HAS THE ENTRIES YOU WILL STORE TO CREATE THE "MERGED" UTILITY NODES
+2 SET X=""
FOR ATSL=0:0
IF X=1!(X=2)!(X="^")!(ATSFLAG)
QUIT
IF X["?"
DO HELP
DO ASKLOOP3
+3 IF ATSFLAG
QUIT
+4 ; IF ATSMTCH=3 THEN USE TEMPLATE TWO
SET ATSENB=$SELECT(ATSMTCH=3:2,1:1)
+5 SET ATSEARCH("FILELINK")=$SELECT(X=1:ATSEARCH(1,"SRCHFILENUM"),1:ATSEARCH("PTRFILENUM"))
+6 ;FOR FILELINK, ATSEARCH(1,"SRCHFILENUM")=(2,"SRCHFILENUM")
+7 SET ATSX=ATSENB
+8 ;ATSX IS USEFUL ONLY IF USER WANTS RESULTS NOT LINKED TO PTR FILE
+9 DO ^ATSERCH4
+10 QUIT
+11 ;
ASKLOOP3 ;CONTINUATION OF FOR LOOP IN ASKFILE3
+1 WRITE !!,"Choose, by number, the file you want results linked to:",!!,1," ",@ATSEOP(1),!,2," ",@ATSEOP(3)
READ !!,"Your choice (1 or 2): 2// ",X:DTIME
+2 IF X=""&($TEST)
SET X=2
IF '$TEST
SET X="^"
IF "^"=X
SET ATSFLAG=$SELECT($DATA(^UTILITY("ATSEARCH",$JOB,"MERGED")):2,1:1)
+3 QUIT
+4 ;
ASKFILE4 ;PTRFILE,SRCHFILE1,SRCHFILE2 DIFF FILES, INTERSECTION OF TEMPLATES
+1 SET X=""
FOR ATSL=0:0
IF (X'<1&(X'>3))!(X="^")!(ATSFLAG)
QUIT
IF X["?"
DO HELP
DO ASKLOOP4
+2 IF ATSFLAG
QUIT
+3 SET ATSEARCH("FILELINK")=$SELECT(X=1:ATSEARCH(1,"SRCHFILENUM"),X=2:ATSEARCH(2,"SRCHFILENUM"),1:ATSEARCH("PTRFILENUM"))
SET ATSX=X
+4 DO ^ATSERCH4
+5 QUIT
+6 ;
ASKLOOP4 ;CONTINUATION OF FOR LOOP IN ASKFILE4
+1 WRITE !!,"Choose, by number, the file you want merged results linked to:",!!,1," ",@ATSEOP(1),!,2," ",@ATSEOP(2),!,3," ",@ATSEOP(3)
READ !!,"Your choice (1-3): 3// ",X:DTIME
+2 IF X=""&($TEST)
SET X=3
IF '$TEST
SET X="^"
IF "^"=X
SET ATSFLAG=$SELECT($DATA(^UTILITY("ATSEARCH",$JOB,"MERGED")):2,1:1)
+3 QUIT
+4 ;
HELP ; - EP - CALL TO HELP FRAME
+1 SET XQH="ATSEARCH-LINK"
SET DIC(0)="X"
DO EN^XQH
+2 IF $DATA(IOF)
WRITE @IOF
+3 QUIT
+4 ;
EOJ ;
+1 KILL ATSEOP,ATSENB,ATSEY,ATSNPT
+2 QUIT
+3 ;
OPTIONS ;MENU CHOICES
+1 ;;ATSEARCH(1,"SRCHFILENAM")
+2 ;;ATSEARCH(2,"SRCHFILENAM")
+3 ;;ATSEARCH("PTRFILENAM")
+4 ;;