- ATSERCH3 ;TUCSON/DG;ASKS USER IF WANTS TO STORE RESULTS AT THIS POINT [ 10/25/91 1:38 PM ]
- ;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
- ;
- S Y="" F L=0:0 Q:Y D ASK
- Q
- ;
- ASK ;
- S ATSRCSTR=0
- W !!,"Would you like to save the results of the following search comparison",!,"in a search template (template will be linked to the ",$P(^DIC(ATSEARCH("FILELINK"),0),U)," file) " S %=2 D YN^DICN
- I %=2 S Y=1 Q
- I %=0 D HELP Q
- I %=-1 S ATSFLAG=$S($D(^UTILITY("ATSEARCH",$J,"MERGED")):2,1:1) S Y=1 Q
- E S Y="" F L=0:0 Q:Y D SORTEMP
- Q
- ;
- SORTEMP ;CREATES SORT TEMPLATE WITH MERGED SEARCH RESULTS
- ;LINKS TO CHOSEN FILE
- S ATSRCSTR=1
- W ! S DIC="^DIBT(",DIC("DR")="[ATSEARCH]",DIC(0)="AEMQL",DLAYGO=.401,DIC("A")="Select SEARCH TEMPLATE: ",DIC("S")="I $P(^(0),U,5)=DUZ&($P(^(0),U,4)=ATSEARCH(""FILELINK""))" D ^DIC K DIC I Y<0 S ATSRCSTR=0 Q
- S ATSETMP=+Y ;SAVE DFN OF TEMPLATE CHOSEN OR CREATED BY USER
- I $D(^DIBT(ATSETMP,2)) W !!,*7,"You cannot store results in a template used only for sort purposes." S Y="" Q
- I '$D(^DIBT(ATSETMP,1))&('$D(^DIBT(ATSETMP,"DIS"))) Q ;NO RESULTS, NO FM SEARCH CODE
- I ATSETMP=$P(ATSEARCH("SRCHTEMPDFN",1),U)!(ATSETMP=$P(ATSEARCH("SRCHTEMPDFN",2),U)) W !!,*7,"Choose a template other than the one(s) you are using in the comparison." S Y="" Q
- I $D(^DIBT(ATSETMP,1)) W !!,*7,"Results already stored in this template. Do you want to have",!,"the stored data deleted" S %=1 D YN^DICN
- I '$D(^DIBT(ATSETMP,1)) S %=1 ;IF A SEARCH TEMPLATE WITH NO RESULTS STORED
- I %=2!(%=0)!(%=-1) S Y="" Q
- I %=1 K ^DIBT(ATSETMP,1),^("DIS"),^("O") S DIE="^DIBT(",DA=ATSETMP,DR="[ATSDESC]" D ^DIE K DIE S Y=1 Q
- Q
- ;
- SEARCH ; - EP - CREATES RESULT NODES AND SPECIFCATION NODES IN ^DIBT(ATSETMP,
- S ATSTMPNM=$P(^DIBT(ATSETMP,0),U)
- I ATSEARCH("MERGE COUNT")=0 S DIK="^DIBT(",DA=ATSETMP D ^DIK K ATSETMP W !!,*7,"The ",ATSTMPNM," template was deleted since there were 0 matches." H 3 Q
- S (ATSDFN,ATSUM,ATSEDOT)=0
- W:'ATSTASK !! F ATSL=0:0 S ATSDFN=$O(^UTILITY("ATSEARCH",$J,"MERGED",3,ATSDFN)) Q:ATSDFN'=+ATSDFN S ^DIBT(ATSETMP,1,ATSDFN)="",ATSEDOT=ATSEDOT+1 W:'ATSTASK&('ATSEDOT#20) "."
- S ^DIBT(ATSETMP,1,0)=ATSEARCH("MERGE COUNT") ; added line 2-7-91 dg/ohprd
- I ATSTASK W !!,"There ",$S(ATSEARCH("MERGE COUNT")=1:"was ",1:"were "),ATSEARCH("MERGE COUNT"),$S(ATSEARCH("MERGE COUNT")=1:" match ",1:" matches "),"entered into the ",ATSTMPNM," search template"
- E W "Results entered into search template" H 2
- K ATSDFN,ATSUM,ATSETMP,ATSEDOT,ATSTMPNM
- Q
- ;
- HELP ;
- S XQH="ATSEARCH-CREATE-TEMPLATE",DIC(0)="X" D EN^XQH
- W:$D(IOF) @IOF
- Q
- ;
- EOJ ;
- K Y
- Q
- ;
- ATSERCH3 ;TUCSON/DG;ASKS USER IF WANTS TO STORE RESULTS AT THIS POINT [ 10/25/91 1:38 PM ]
- +1 ;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
- +2 ;
- +3 SET Y=""
- FOR L=0:0
- IF Y
- QUIT
- DO ASK
- +4 QUIT
- +5 ;
- ASK ;
- +1 SET ATSRCSTR=0
- +2 WRITE !!,"Would you like to save the results of the following search comparison",!,"in a search template (template will be linked to the ",$PIECE(^DIC(ATSEARCH("FILELINK"),0),U)," file) "
- SET %=2
- DO YN^DICN
- +3 IF %=2
- SET Y=1
- QUIT
- +4 IF %=0
- DO HELP
- QUIT
- +5 IF %=-1
- SET ATSFLAG=$SELECT($DATA(^UTILITY("ATSEARCH",$JOB,"MERGED")):2,1:1)
- SET Y=1
- QUIT
- +6 IF '$TEST
- SET Y=""
- FOR L=0:0
- IF Y
- QUIT
- DO SORTEMP
- +7 QUIT
- +8 ;
- SORTEMP ;CREATES SORT TEMPLATE WITH MERGED SEARCH RESULTS
- +1 ;LINKS TO CHOSEN FILE
- +2 SET ATSRCSTR=1
- +3 WRITE !
- SET DIC="^DIBT("
- SET DIC("DR")="[ATSEARCH]"
- SET DIC(0)="AEMQL"
- SET DLAYGO=.401
- SET DIC("A")="Select SEARCH TEMPLATE: "
- SET DIC("S")="I $P(^(0),U,5)=DUZ&($P(^(0),U,4)=ATSEARCH(""FILELINK""))"
- DO ^DIC
- KILL DIC
- IF Y<0
- SET ATSRCSTR=0
- QUIT
- +4 ;SAVE DFN OF TEMPLATE CHOSEN OR CREATED BY USER
- SET ATSETMP=+Y
- +5 IF $DATA(^DIBT(ATSETMP,2))
- WRITE !!,*7,"You cannot store results in a template used only for sort purposes."
- SET Y=""
- QUIT
- +6 ;NO RESULTS, NO FM SEARCH CODE
- IF '$DATA(^DIBT(ATSETMP,1))&('$DATA(^DIBT(ATSETMP,"DIS")))
- QUIT
- +7 IF ATSETMP=$PIECE(ATSEARCH("SRCHTEMPDFN",1),U)!(ATSETMP=$PIECE(ATSEARCH("SRCHTEMPDFN",2),U))
- WRITE !!,*7,"Choose a template other than the one(s) you are using in the comparison."
- SET Y=""
- QUIT
- +8 IF $DATA(^DIBT(ATSETMP,1))
- WRITE !!,*7,"Results already stored in this template. Do you want to have",!,"the stored data deleted"
- SET %=1
- DO YN^DICN
- +9 ;IF A SEARCH TEMPLATE WITH NO RESULTS STORED
- IF '$DATA(^DIBT(ATSETMP,1))
- SET %=1
- +10 IF %=2!(%=0)!(%=-1)
- SET Y=""
- QUIT
- +11 IF %=1
- KILL ^DIBT(ATSETMP,1),^("DIS"),^("O")
- SET DIE="^DIBT("
- SET DA=ATSETMP
- SET DR="[ATSDESC]"
- DO ^DIE
- KILL DIE
- SET Y=1
- QUIT
- +12 QUIT
- +13 ;
- SEARCH ; - EP - CREATES RESULT NODES AND SPECIFCATION NODES IN ^DIBT(ATSETMP,
- +1 SET ATSTMPNM=$PIECE(^DIBT(ATSETMP,0),U)
- +2 IF ATSEARCH("MERGE COUNT")=0
- SET DIK="^DIBT("
- SET DA=ATSETMP
- DO ^DIK
- KILL ATSETMP
- WRITE !!,*7,"The ",ATSTMPNM," template was deleted since there were 0 matches."
- HANG 3
- QUIT
- +3 SET (ATSDFN,ATSUM,ATSEDOT)=0
- +4 IF 'ATSTASK
- WRITE !!
- FOR ATSL=0:0
- SET ATSDFN=$ORDER(^UTILITY("ATSEARCH",$JOB,"MERGED",3,ATSDFN))
- IF ATSDFN'=+ATSDFN
- QUIT
- SET ^DIBT(ATSETMP,1,ATSDFN)=""
- SET ATSEDOT=ATSEDOT+1
- IF 'ATSTASK&('ATSEDOT#20)
- WRITE "."
- +5 ; added line 2-7-91 dg/ohprd
- SET ^DIBT(ATSETMP,1,0)=ATSEARCH("MERGE COUNT")
- +6 IF ATSTASK
- WRITE !!,"There ",$SELECT(ATSEARCH("MERGE COUNT")=1:"was ",1:"were "),ATSEARCH("MERGE COUNT"),$SELECT(ATSEARCH("MERGE COUNT")=1:" match ",1:" matches "),"entered into the ",ATSTMPNM," search template"
- +7 IF '$TEST
- WRITE "Results entered into search template"
- HANG 2
- +8 KILL ATSDFN,ATSUM,ATSETMP,ATSEDOT,ATSTMPNM
- +9 QUIT
- +10 ;
- HELP ;
- +1 SET XQH="ATSEARCH-CREATE-TEMPLATE"
- SET DIC(0)="X"
- DO EN^XQH
- +2 IF $DATA(IOF)
- WRITE @IOF
- +3 QUIT
- +4 ;
- EOJ ;
- +1 KILL Y
- +2 QUIT
- +3 ;