VistA-WorldVistAEHR/r/NOIS-FSC/FSCQS.m

52 lines
1.6 KiB
Mathematica

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)