source: WorldVistAEHR/trunk/r/NOIS-FSC/FSCQR.m@ 1746

Last change on this file since 1746 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 1.8 KB
Line 
1FSCQR ;SLC/STAFF-NOIS Query Routing ;1/11/98 18:46
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4QUERY(LIST,LISTCNT,CRITERIA) ; from FSCLP, FSCQB, FSCRPCQ
5 ; ***make lists globals
6 N NEWCALL,NEWSTEP,OP,SEQNUM
7 S OP=$P(CRITERIA(0),U)
8 I OP="Add" D Q
9 .I $P(CRITERIA(0),U,2)>1,$P(CRITERIA(0),U,2)<4 D Q ;*** test when multiple passes better than all calls
10 ..S $P(CRITERIA(0),U,2)=1
11 ..S NEWSTEP=0 F S NEWSTEP=$O(CRITERIA(NEWSTEP)) Q:NEWSTEP<1 D
12 ...K ^TMP("FSC USELIST",$J)
13 ...D SEARCH^FSCQS(0,.CRITERIA)
14 ...S NEWCALL=0 F S NEWCALL=$O(^TMP("FSC NEWLIST",$J,NEWCALL)) Q:NEWCALL<1 S ^TMP("FSC LIST",$J,NEWCALL,0)=NEWCALL
15 ...S LISTCNT=$$COUNT
16 ...K CRITERIA(NEWSTEP)
17 ...S SEQNUM=0 F S SEQNUM=$O(CRITERIA("O",SEQNUM)) Q:SEQNUM<1 I CRITERIA("O",SEQNUM)=NEWSTEP K CRITERIA("O",SEQNUM) Q
18 .K ^TMP("FSC USELIST",$J)
19 .D SEARCH^FSCQS(0,.CRITERIA)
20 .S NEWCALL=0 F S NEWCALL=$O(^TMP("FSC NEWLIST",$J,NEWCALL)) Q:NEWCALL<1 S ^TMP("FSC LIST",$J,NEWCALL,0)=NEWCALL
21 .S LISTCNT=$$COUNT
22 I OP="Remove" D Q
23 .I LISTCNT=0 Q
24 .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)=""
25 .D SEARCH^FSCQS(LISTCNT,.CRITERIA)
26 .S NEWCALL=0 F S NEWCALL=$O(^TMP("FSC NEWLIST",$J,NEWCALL)) Q:NEWCALL<1 K ^TMP("FSC LIST",$J,NEWCALL)
27 .S LISTCNT=$$COUNT
28 ; select
29 I LISTCNT=0 Q
30 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)=""
31 D SEARCH^FSCQS(LISTCNT,.CRITERIA)
32 K ^TMP("FSC LIST",$J),LIST
33 S NEWCALL=0 F S NEWCALL=$O(^TMP("FSC NEWLIST",$J,NEWCALL)) Q:NEWCALL<1 S ^TMP("FSC LIST",$J,NEWCALL,0)=NEWCALL
34 S LISTCNT=$$COUNT
35 Q
36 ;
37COUNT() ; $$() -> number of calls in list
38 N CALL,CNT S (CALL,CNT)=0 F S CALL=$O(^TMP("FSC LIST",$J,CALL)) Q:CALL<1 S CNT=CNT+1
39 Q CNT
Note: See TracBrowser for help on using the repository browser.