FSCQB ;SLC/STAFF-NOIS Query Browse ;1/19/98 11:26
;;1.1;NOIS;;Sep 06, 1998
;
BROWSE(LIST,LISTNAME,LISTCNT,MSG,PREOP,LISTDEF) ; from FSCLD, FSCLMPO, FSCLMPQQ, FSCLMPQU, FSCOPT
N ANDOR,CNT,DESC,DESCNT,DONE,DTOUT,DUOUT,FINISH,OPER,LDCNT
S LDCNT=0
S DEFINE=$S($D(LISTDEF):1,1:0)
S FINISH=$S(DEFINE:"Define",1:"List")
S DESCNT=0,DESC(DESCNT)="List: "_LISTNAME
S DONE=0 F Q:DONE D
.N CRITERIA
.I 'DEFINE,$G(PREOP)'=FINISH W !!,"Currently, "_LISTCNT_" calls are in this list."
.I $G(PREOP)'=FINISH S CNT="" F S CNT=$O(DESC(CNT)) Q:CNT="" D
..W !,DESC(CNT)
.I '$L($G(PREOP)) D OPER^FSCQCA
.I $L($G(PREOP)) W:PREOP'=FINISH !?4,PREOP," where:" S OPER=PREOP,PREOP=FINISH
.I $D(DUOUT) S MSG="EXIT",DONE=1 Q
.I $D(DTOUT) S MSG="TIMEOUT",DONE=1 Q
.I OPER="List" S DONE=1 Q
.I OPER="Define" S DONE=1 Q
.I DEFINE S LISTCNT=1,PREOP=""
.S CRITERIA(0)=OPER_"^^0"
.D CRITERIA
.I MSG="EXIT" S MSG=1 W !,"No Action Taken",! Q
.I MSG="TIMEOUT" S DONE=1 W !,"No Action Taken",! Q
.D DESC^FSCQD(.DESCNT,.CRITERIA)
.I 'DEFINE D QUERY^FSCQR(.LIST,.LISTCNT,.CRITERIA) K ^TMP("FSC NEWLIST",$J),^TMP("FSC USELIST",$J)
I DEFINE M @LISTDEF@("DESC")=DESC
Q
;
CRITERIA ;
N COND,DONE,FIELD,FIELDCNT,FPASS,NAME,PAREN,PREVF,PREVS,REASK,STEP,TYPE,VALUE
S (DONE,FIELDCNT,PREVS,PREVF,REASK,STEP)=0,FPASS=1,PAREN="closed",ANDOR=""
F Q:DONE D
.I 'FPASS D
..I MSG="REASK" D
...W !!?12,"*** You have entered a criteria that is not complete. ***",$C(7)
...W !,"The partial entry was: ",ANDOR," ",$P(FIELD,U,2)," ",$P(COND,U,5)," ",$P(VALUE,U,2)
...I '$D(CRITERIA(1)) S MSG="EXIT" W !,"Reenter criteria" Q
...D CRITERIA^FSCQD(.CRITERIA)
...W !,"Continue editing from this criteria.",!
..I MSG="EXIT" S MSG=1 Q
..I MSG'="REASK" D STORE^FSCQCS S (FIELD,COND,VALUE)=""
..S MSG=1
..D ANDOR^FSCQCA W !
..I $D(DTOUT) S MSG="TIMEOUT",DONE=1 Q
..I $D(DUOUT) S MSG="EXIT",DONE=1
..I ANDOR="" S DONE=1
..I DONE,PAREN="open" S CRITERIA(STEP,FIELDCNT,0)=CRITERIA(STEP,FIELDCNT,0)_")"
.I DONE Q
.I '$L(ANDOR) S FPASS=1
.W !
.S (FIELD,COND,VALUE)=""
.D FIELD^FSCQCA,CHECK Q:DONE Q:MSG="REASK"
.S FPASS=0
.D COND^FSCQCA($P(FIELD,U,4)),CHECK Q:DONE Q:MSG="REASK"
.D VALUE^FSCQCAV(COND,$P(FIELD,U,4)),CHECK Q:DONE Q:MSG="REASK"
.S FPASS=0
Q
;
CHECK I $D(DTOUT) S MSG="TIMEOUT",DONE=1 Q
I Y="^^"!(FPASS&(Y=""!$D(DUOUT))) S MSG="EXIT",DONE=1 Q
I 'FPASS,Y=""!$D(DUOUT) S MSG="REASK" Q
S MSG=$G(MSG,1)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCQB 2473 printed Oct 16, 2024@18:19:28 Page 2
FSCQB ;SLC/STAFF-NOIS Query Browse ;1/19/98 11:26
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
BROWSE(LIST,LISTNAME,LISTCNT,MSG,PREOP,LISTDEF) ; from FSCLD, FSCLMPO, FSCLMPQQ, FSCLMPQU, FSCOPT
+1 NEW ANDOR,CNT,DESC,DESCNT,DONE,DTOUT,DUOUT,FINISH,OPER,LDCNT
+2 SET LDCNT=0
+3 SET DEFINE=$SELECT($DATA(LISTDEF):1,1:0)
+4 SET FINISH=$SELECT(DEFINE:"Define",1:"List")
+5 SET DESCNT=0
SET DESC(DESCNT)="List: "_LISTNAME
+6 SET DONE=0
FOR
if DONE
QUIT
Begin DoDot:1
+7 NEW CRITERIA
+8 IF 'DEFINE
IF $GET(PREOP)'=FINISH
WRITE !!,"Currently, "_LISTCNT_" calls are in this list."
+9 IF $GET(PREOP)'=FINISH
SET CNT=""
FOR
SET CNT=$ORDER(DESC(CNT))
if CNT=""
QUIT
Begin DoDot:2
+10 WRITE !,DESC(CNT)
End DoDot:2
+11 IF '$LENGTH($GET(PREOP))
DO OPER^FSCQCA
+12 IF $LENGTH($GET(PREOP))
if PREOP'=FINISH
WRITE !?4,PREOP," where:"
SET OPER=PREOP
SET PREOP=FINISH
+13 IF $DATA(DUOUT)
SET MSG="EXIT"
SET DONE=1
QUIT
+14 IF $DATA(DTOUT)
SET MSG="TIMEOUT"
SET DONE=1
QUIT
+15 IF OPER="List"
SET DONE=1
QUIT
+16 IF OPER="Define"
SET DONE=1
QUIT
+17 IF DEFINE
SET LISTCNT=1
SET PREOP=""
+18 SET CRITERIA(0)=OPER_"^^0"
+19 DO CRITERIA
+20 IF MSG="EXIT"
SET MSG=1
WRITE !,"No Action Taken",!
QUIT
+21 IF MSG="TIMEOUT"
SET DONE=1
WRITE !,"No Action Taken",!
QUIT
+22 DO DESC^FSCQD(.DESCNT,.CRITERIA)
+23 IF 'DEFINE
DO QUERY^FSCQR(.LIST,.LISTCNT,.CRITERIA)
KILL ^TMP("FSC NEWLIST",$JOB),^TMP("FSC USELIST",$JOB)
End DoDot:1
+24 IF DEFINE
MERGE @LISTDEF@("DESC")=DESC
+25 QUIT
+26 ;
CRITERIA ;
+1 NEW COND,DONE,FIELD,FIELDCNT,FPASS,NAME,PAREN,PREVF,PREVS,REASK,STEP,TYPE,VALUE
+2 SET (DONE,FIELDCNT,PREVS,PREVF,REASK,STEP)=0
SET FPASS=1
SET PAREN="closed"
SET ANDOR=""
+3 FOR
if DONE
QUIT
Begin DoDot:1
+4 IF 'FPASS
Begin DoDot:2
+5 IF MSG="REASK"
Begin DoDot:3
+6 WRITE !!?12,"*** You have entered a criteria that is not complete. ***",$CHAR(7)
+7 WRITE !,"The partial entry was: ",ANDOR," ",$PIECE(FIELD,U,2)," ",$PIECE(COND,U,5)," ",$PIECE(VALUE,U,2)
+8 IF '$DATA(CRITERIA(1))
SET MSG="EXIT"
WRITE !,"Reenter criteria"
QUIT
+9 DO CRITERIA^FSCQD(.CRITERIA)
+10 WRITE !,"Continue editing from this criteria.",!
End DoDot:3
+11 IF MSG="EXIT"
SET MSG=1
QUIT
+12 IF MSG'="REASK"
DO STORE^FSCQCS
SET (FIELD,COND,VALUE)=""
+13 SET MSG=1
+14 DO ANDOR^FSCQCA
WRITE !
+15 IF $DATA(DTOUT)
SET MSG="TIMEOUT"
SET DONE=1
QUIT
+16 IF $DATA(DUOUT)
SET MSG="EXIT"
SET DONE=1
+17 IF ANDOR=""
SET DONE=1
+18 IF DONE
IF PAREN="open"
SET CRITERIA(STEP,FIELDCNT,0)=CRITERIA(STEP,FIELDCNT,0)_")"
End DoDot:2
+19 IF DONE
QUIT
+20 IF '$LENGTH(ANDOR)
SET FPASS=1
+21 WRITE !
+22 SET (FIELD,COND,VALUE)=""
+23 DO FIELD^FSCQCA
DO CHECK
if DONE
QUIT
if MSG="REASK"
QUIT
+24 SET FPASS=0
+25 DO COND^FSCQCA($PIECE(FIELD,U,4))
DO CHECK
if DONE
QUIT
if MSG="REASK"
QUIT
+26 DO VALUE^FSCQCAV(COND,$PIECE(FIELD,U,4))
DO CHECK
if DONE
QUIT
if MSG="REASK"
QUIT
+27 SET FPASS=0
End DoDot:1
+28 QUIT
+29 ;
CHECK IF $DATA(DTOUT)
SET MSG="TIMEOUT"
SET DONE=1
QUIT
+1 IF Y="^^"!(FPASS&(Y=""!$DATA(DUOUT)))
SET MSG="EXIT"
SET DONE=1
QUIT
+2 IF 'FPASS
IF Y=""!$DATA(DUOUT)
SET MSG="REASK"
QUIT
+3 SET MSG=$GET(MSG,1)
+4 QUIT