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

36 lines
1.6 KiB
Mathematica

FSCQD ;SLC/STAFF-NOIS Query Description ;4/22/94 11:56
;;1.1;NOIS;;Sep 06, 1998
;
DESC(DESCNT,CRITERIA) ; from FSCLMPMQ, FSCQB
N STEP,FCOND,NDESC
I 'DEFINE,DESC(0)'[" (MODIFIED)" S DESC(0)=DESC(0)_" (MODIFIED)"
S DESCNT=DESCNT+1,DESC=" "_$P(CRITERIA(0),U)_" where:"
S STEP=0 F S STEP=$O(CRITERIA(STEP)) Q:STEP="" D
.S FCOND=0 F S FCOND=$O(CRITERIA(STEP,FCOND)) Q:FCOND="" D
..S NDESC=CRITERIA(STEP,FCOND,1)_$S($L(CRITERIA(STEP,FCOND,1)):" ",1:"")_CRITERIA(STEP,FCOND,0)
..I $L(NDESC)+$L(DESC)+2<$G(IOM,80) S DESC=DESC_" "_NDESC Q
..S DESC(DESCNT)=DESC,DESC=NDESC,DESCNT=DESCNT+1
S DESC(DESCNT)=DESC
I DEFINE S LDCNT=LDCNT+1 M @LISTDEF@(LDCNT)=CRITERIA
Q
CRITERIA(CRITERIA) ; from FSCQB
N STEP,FCOND,NEWLINE,LINE,NEWDESC,CNT
S CNT=0,LINE="The last complete criteria was:"
S STEP=0 F S STEP=$O(CRITERIA(STEP)) Q:STEP="" D
.S FCOND=0 F S FCOND=$O(CRITERIA(STEP,FCOND)) Q:FCOND="" D
..S NEWLINE=CRITERIA(STEP,FCOND,1)_$S($L(CRITERIA(STEP,FCOND,1)):" ",1:"")_CRITERIA(STEP,FCOND,0)
..I $L(NEWLINE)+$L(LINE)+2<$G(IOM,80) S LINE=LINE_" "_NEWLINE Q
..S NEWDESC(CNT)=LINE,LINE=NEWLINE,CNT=CNT+1
S NEWDESC(CNT)=LINE
S CNT="" F S CNT=$O(NEWDESC(CNT)) Q:CNT="" D
.W !,NEWDESC(CNT)
Q
HELP ; executed from FSCQU and DIR
N CNT
I $O(CRITERIA(0)) D CRITERIA(.CRITERIA)
I $L($G(ANDOR))!$L($G(FIELD)) D
.W !,"You are now entering:",!,$S($L($G(ANDOR)):ANDOR_" ",1:""),$S($L(FIELD):$P(FIELD,U,3)_" ",1:""),$S($L(COND):$P(COND,U,5)_" ",1:""),$S($L(VALUE):$P(VALUE,U,2)_" ",1:"")
S CNT=0 F S CNT=$O(DIR("?",CNT)) Q:CNT<1 W !,DIR("?",CNT)
W !,"Enter '^' to exit, '??' for additional help."
Q