Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ATSERCH3

ATSERCH3.m

Go to the documentation of this file.
  1. 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
  1. ;
  1. S Y="" F L=0:0 Q:Y D ASK
  1. Q
  1. ;
  1. ASK ;
  1. S ATSRCSTR=0
  1. 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
  1. I %=2 S Y=1 Q
  1. I %=0 D HELP Q
  1. I %=-1 S ATSFLAG=$S($D(^UTILITY("ATSEARCH",$J,"MERGED")):2,1:1) S Y=1 Q
  1. E S Y="" F L=0:0 Q:Y D SORTEMP
  1. Q
  1. ;
  1. SORTEMP ;CREATES SORT TEMPLATE WITH MERGED SEARCH RESULTS
  1. ;LINKS TO CHOSEN FILE
  1. S ATSRCSTR=1
  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
  1. S ATSETMP=+Y ;SAVE DFN OF TEMPLATE CHOSEN OR CREATED BY USER
  1. I $D(^DIBT(ATSETMP,2)) W !!,*7,"You cannot store results in a template used only for sort purposes." S Y="" Q
  1. I '$D(^DIBT(ATSETMP,1))&('$D(^DIBT(ATSETMP,"DIS"))) Q ;NO RESULTS, NO FM SEARCH CODE
  1. 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
  1. 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
  1. I '$D(^DIBT(ATSETMP,1)) S %=1 ;IF A SEARCH TEMPLATE WITH NO RESULTS STORED
  1. I %=2!(%=0)!(%=-1) S Y="" Q
  1. I %=1 K ^DIBT(ATSETMP,1),^("DIS"),^("O") S DIE="^DIBT(",DA=ATSETMP,DR="[ATSDESC]" D ^DIE K DIE S Y=1 Q
  1. Q
  1. ;
  1. S ATSTMPNM=$P(^DIBT(ATSETMP,0),U)
  1. 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
  1. S (ATSDFN,ATSUM,ATSEDOT)=0
  1. 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) "."
  1. S ^DIBT(ATSETMP,1,0)=ATSEARCH("MERGE COUNT") ; added line 2-7-91 dg/ohprd
  1. 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"
  1. E W "Results entered into search template" H 2
  1. K ATSDFN,ATSUM,ATSETMP,ATSEDOT,ATSTMPNM
  1. Q
  1. ;
  1. HELP ;
  1. S XQH="ATSEARCH-CREATE-TEMPLATE",DIC(0)="X" D EN^XQH
  1. W:$D(IOF) @IOF
  1. Q
  1. ;
  1. EOJ ;
  1. K Y
  1. Q
  1. ;