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

FSCQR.m

Go to the documentation of this file.
FSCQR ;SLC/STAFF-NOIS Query Routing ;1/11/98  18:46
 ;;1.1;NOIS;;Sep 06, 1998
 ;
QUERY(LIST,LISTCNT,CRITERIA) ; from FSCLP, FSCQB, FSCRPCQ
 ; ***make lists globals
 N NEWCALL,NEWSTEP,OP,SEQNUM
 S OP=$P(CRITERIA(0),U)
 I OP="Add" D  Q
 .I $P(CRITERIA(0),U,2)>1,$P(CRITERIA(0),U,2)<4 D  Q  ;*** test when multiple passes better than all calls
 ..S $P(CRITERIA(0),U,2)=1
 ..S NEWSTEP=0 F  S NEWSTEP=$O(CRITERIA(NEWSTEP)) Q:NEWSTEP<1  D
 ...K ^TMP("FSC USELIST",$J)
 ...D SEARCH^FSCQS(0,.CRITERIA)
 ...S NEWCALL=0 F  S NEWCALL=$O(^TMP("FSC NEWLIST",$J,NEWCALL)) Q:NEWCALL<1  S ^TMP("FSC LIST",$J,NEWCALL,0)=NEWCALL
 ...S LISTCNT=$$COUNT
 ...K CRITERIA(NEWSTEP)
 ...S SEQNUM=0 F  S SEQNUM=$O(CRITERIA("O",SEQNUM)) Q:SEQNUM<1  I CRITERIA("O",SEQNUM)=NEWSTEP K CRITERIA("O",SEQNUM) Q
 .K ^TMP("FSC USELIST",$J)
 .D SEARCH^FSCQS(0,.CRITERIA)
 .S NEWCALL=0 F  S NEWCALL=$O(^TMP("FSC NEWLIST",$J,NEWCALL)) Q:NEWCALL<1  S ^TMP("FSC LIST",$J,NEWCALL,0)=NEWCALL
 .S LISTCNT=$$COUNT
 I OP="Remove" D  Q
 .I LISTCNT=0 Q
 .K ^TMP("FSC USELIST",$J) S NEWCALL=0 F  S NEWCALL=$O(^TMP("FSC LIST",$J,NEWCALL)) Q:NEWCALL<1  S ^TMP("FSC USELIST",$J,NEWCALL)=""
 .D SEARCH^FSCQS(LISTCNT,.CRITERIA)
 .S NEWCALL=0 F  S NEWCALL=$O(^TMP("FSC NEWLIST",$J,NEWCALL)) Q:NEWCALL<1  K ^TMP("FSC LIST",$J,NEWCALL)
 .S LISTCNT=$$COUNT
 ; select
 I LISTCNT=0 Q
 K ^TMP("FSC USELIST",$J),LIST S NEWCALL=0 F  S NEWCALL=$O(^TMP("FSC LIST",$J,NEWCALL)) Q:NEWCALL<1  S ^TMP("FSC USELIST",$J,NEWCALL)=""
 D SEARCH^FSCQS(LISTCNT,.CRITERIA)
 K ^TMP("FSC LIST",$J),LIST
 S NEWCALL=0 F  S NEWCALL=$O(^TMP("FSC NEWLIST",$J,NEWCALL)) Q:NEWCALL<1  S ^TMP("FSC LIST",$J,NEWCALL,0)=NEWCALL
 S LISTCNT=$$COUNT
 Q
 ;
COUNT() ; $$() -> number of calls in list
 N CALL,CNT S (CALL,CNT)=0 F  S CALL=$O(^TMP("FSC LIST",$J,CALL)) Q:CALL<1  S CNT=CNT+1
 Q CNT