FSCQS ;SLC/STAFF-NOIS Query Search ;5/25/98 19:00
;;1.1;NOIS;;Sep 06, 1998
;
SEARCH(LISTCNT,CRITERIA) ; from FSCQR
S LIST=$$LIST(LISTCNT)
I '$D(CRITERIA("O")) D OPTIMIZE^FSCQO(.CRITERIA)
K ^TMP("FSC NEWLIST",$J) N ACTION,CVALUE,FCOND,QUERY,STEP
I $P(CRITERIA(0),U,2)=1 D Q
.S STEP=$O(CRITERIA(0))
.I CRITERIA(STEP)=1 D Q
..S ACTION="S ^TMP(""FSC NEWLIST"",$J,CALL)="""""
..S QUERY=CRITERIA(STEP,+$O(CRITERIA(STEP,0)))
..D CHECK(LIST,$P(QUERY,U),$P(QUERY,U,2),$P(QUERY,U,3))
.S ACTION="D MULT^FSCQSM(CALL)"
.D SETUP^FSCQSS
.D CHECK(LIST,$P(QUERY,U),$P(QUERY,U,2),$P(QUERY,U,3))
S ACTION="D MMULT^FSCQSM(CALL)"
D SETUP^FSCQSSM
D ALL^FSCQSA
Q
CHECK(LIST,FIELD,COND,VALUE) ; *** needs to handle special code, word processing
N TYPE,INDEX,CODE
S TYPE=$P(CRITERIA("F",FIELD),U),CODE=$P(CRITERIA("F",FIELD),U,2),INDEX=$P(CRITERIA("F",FIELD),U,3)
;I CODE["7100.6," Q ;**** fix for personal field search
I TYPE="W" D Q
.I COND="[" D CON^FSCQSW Q
.I COND="exists" D EX^FSCQSW Q
.I COND="'[" D NCON^FSCQSW Q
.I COND="not exists" D NEX^FSCQSW Q
I '$L(INDEX) D Q
.I COND="exists" D EX^FSCQSN Q
.I COND="not exists" D NEX^FSCQSN Q
.I COND="range" D R^FSCQSR Q
.I COND="not range" D NR^FSCQSR Q
.D OTHER^FSCQSN Q
I COND="=" D EQ^FSCQSE Q
I COND=">" D GT^FSCQSG Q
I COND="<" D LT^FSCQSL Q
I COND="[" D CON^FSCQSC Q
I COND="exists" D EX^FSCQSX Q
I COND="range" D R^FSCQSR Q
I COND="'=" D NEQ^FSCQSE Q
I COND="'>" D NGT^FSCQSG Q
I COND="'<" D NLT^FSCQSL Q
I COND="'[" D NCON^FSCQSC Q
I COND="not exists" D NEX^FSCQSX Q
I COND="not range" D NR^FSCQSR Q
Q
;
LIST(CNT) ; $$(list count) -> "" if 0, 0 if count is >1000, else 1
Q $S(CNT=0:"",CNT>1000:0,1:1)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCQS 1739 printed Dec 13, 2024@02:18:58 Page 2
FSCQS ;SLC/STAFF-NOIS Query Search ;5/25/98 19:00
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
SEARCH(LISTCNT,CRITERIA) ; from FSCQR
+1 SET LIST=$$LIST(LISTCNT)
+2 IF '$DATA(CRITERIA("O"))
DO OPTIMIZE^FSCQO(.CRITERIA)
+3 KILL ^TMP("FSC NEWLIST",$JOB)
NEW ACTION,CVALUE,FCOND,QUERY,STEP
+4 IF $PIECE(CRITERIA(0),U,2)=1
Begin DoDot:1
+5 SET STEP=$ORDER(CRITERIA(0))
+6 IF CRITERIA(STEP)=1
Begin DoDot:2
+7 SET ACTION="S ^TMP(""FSC NEWLIST"",$J,CALL)="""""
+8 SET QUERY=CRITERIA(STEP,+$ORDER(CRITERIA(STEP,0)))
+9 DO CHECK(LIST,$PIECE(QUERY,U),$PIECE(QUERY,U,2),$PIECE(QUERY,U,3))
End DoDot:2
QUIT
+10 SET ACTION="D MULT^FSCQSM(CALL)"
+11 DO SETUP^FSCQSS
+12 DO CHECK(LIST,$PIECE(QUERY,U),$PIECE(QUERY,U,2),$PIECE(QUERY,U,3))
End DoDot:1
QUIT
+13 SET ACTION="D MMULT^FSCQSM(CALL)"
+14 DO SETUP^FSCQSSM
+15 DO ALL^FSCQSA
+16 QUIT
CHECK(LIST,FIELD,COND,VALUE) ; *** needs to handle special code, word processing
+1 NEW TYPE,INDEX,CODE
+2 SET TYPE=$PIECE(CRITERIA("F",FIELD),U)
SET CODE=$PIECE(CRITERIA("F",FIELD),U,2)
SET INDEX=$PIECE(CRITERIA("F",FIELD),U,3)
+3 ;I CODE["7100.6," Q ;**** fix for personal field search
+4 IF TYPE="W"
Begin DoDot:1
+5 IF COND="["
DO CON^FSCQSW
QUIT
+6 IF COND="exists"
DO EX^FSCQSW
QUIT
+7 IF COND="'["
DO NCON^FSCQSW
QUIT
+8 IF COND="not exists"
DO NEX^FSCQSW
QUIT
End DoDot:1
QUIT
+9 IF '$LENGTH(INDEX)
Begin DoDot:1
+10 IF COND="exists"
DO EX^FSCQSN
QUIT
+11 IF COND="not exists"
DO NEX^FSCQSN
QUIT
+12 IF COND="range"
DO R^FSCQSR
QUIT
+13 IF COND="not range"
DO NR^FSCQSR
QUIT
+14 DO OTHER^FSCQSN
QUIT
End DoDot:1
QUIT
+15 IF COND="="
DO EQ^FSCQSE
QUIT
+16 IF COND=">"
DO GT^FSCQSG
QUIT
+17 IF COND="<"
DO LT^FSCQSL
QUIT
+18 IF COND="["
DO CON^FSCQSC
QUIT
+19 IF COND="exists"
DO EX^FSCQSX
QUIT
+20 IF COND="range"
DO R^FSCQSR
QUIT
+21 IF COND="'="
DO NEQ^FSCQSE
QUIT
+22 IF COND="'>"
DO NGT^FSCQSG
QUIT
+23 IF COND="'<"
DO NLT^FSCQSL
QUIT
+24 IF COND="'["
DO NCON^FSCQSC
QUIT
+25 IF COND="not exists"
DO NEX^FSCQSX
QUIT
+26 IF COND="not range"
DO NR^FSCQSR
QUIT
+27 QUIT
+28 ;
LIST(CNT) ; $$(list count) -> "" if 0, 0 if count is >1000, else 1
+1 QUIT $SELECT(CNT=0:"",CNT>1000:0,1:1)