FSCGETQ ;SLC/STAFF-NOIS Get Query ;4/22/94 10:53
;;1.1;NOIS;;Sep 06, 1998
;
QUERY(DEFNUM,ARRAY) ; from FSCLMM
N EXT,SEQ,DEF,NUM,OP,FIELD,COND,VALUE K ARRAY
S SEQ=0 F S SEQ=$O(^FSC("LIST",DEFNUM,1,SEQ)) Q:SEQ<1 S DEF=$G(^(SEQ,0)) D
.S NUM=$P(DEF,U),OP=$P(DEF,U,2),EXT=$P(DEF,U,3),FIELD=$P(DEF,U,4),COND=$P(DEF,U,5),VALUE=$P(DEF,U,6)
.S ARRAY(SEQ,"NUM")=NUM
.S ARRAY(SEQ,"OP")=$S(OP="A":"Add",OP="R":"Remove",OP="S":"Select",1:"") I $L(ARRAY(SEQ,"OP")) S ARRAY(SEQ,"OP")=ARRAY(SEQ,"OP")_" where:"
.S EXT=$S(EXT="A":"and",EXT="O":"or",1:""),ARRAY(SEQ,"EXT")=$S($L(EXT):EXT,1:"")
.S ARRAY(SEQ,"FIELD")=$$VALUE^FSCGET(FIELD,7107.11,3)
.S ARRAY(SEQ,"COND")=$$VALUE^FSCGET(COND,7107.11,4)
.S ARRAY(SEQ,"VALUE")=$$NONDDV^FSCDD(VALUE,FIELD)
Q
;
FORM(DEFNUM,ARRAY,LINECNT) ; from FSCLMM
S LINECNT=+$G(LINECNT)
N FORMAT,LINE,SEQ
S SEQ=0 F S SEQ=$O(QUERY(SEQ)) Q:SEQ<1 D
.I (SEQ#10)=0,'$G(FSCDEV) W "."
.D SETTEXT^FSCFORM(1,SEQ,1,SEQ)
.D SETTEXT^FSCFORM(1,SEQ,7,QUERY(SEQ,"OP"))
.D SETTEXT^FSCFORM(1,SEQ,15,QUERY(SEQ,"EXT"))
.D SETTEXT^FSCFORM(1,SEQ,25,QUERY(SEQ,"FIELD"))
.D SETTEXT^FSCFORM(1,SEQ,38,QUERY(SEQ,"COND"))
.D SETTEXT^FSCFORM(1,SEQ,45,QUERY(SEQ,"VALUE"))
S LINE=0 F S LINE=$O(FORMAT(1,LINE)) Q:LINE<1 D
.S VALMCNT=VALMCNT+1
.S ^TMP("FSC MODIFY LISTS",$J,VALMCNT,0)=FORMAT(1,LINE)
.S ^TMP("FSC MODIFY LISTS",$J,"IDX",+FORMAT(1,LINE),VALMCNT)=""
S ^TMP("FSC MODIFY LISTS",$J)=+$G(FORMAT(1,+$O(FORMAT(1,"A"),-1)))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCGETQ 1482 printed Nov 22, 2024@17:27:58 Page 2
FSCGETQ ;SLC/STAFF-NOIS Get Query ;4/22/94 10:53
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
QUERY(DEFNUM,ARRAY) ; from FSCLMM
+1 NEW EXT,SEQ,DEF,NUM,OP,FIELD,COND,VALUE
KILL ARRAY
+2 SET SEQ=0
FOR
SET SEQ=$ORDER(^FSC("LIST",DEFNUM,1,SEQ))
if SEQ<1
QUIT
SET DEF=$GET(^(SEQ,0))
Begin DoDot:1
+3 SET NUM=$PIECE(DEF,U)
SET OP=$PIECE(DEF,U,2)
SET EXT=$PIECE(DEF,U,3)
SET FIELD=$PIECE(DEF,U,4)
SET COND=$PIECE(DEF,U,5)
SET VALUE=$PIECE(DEF,U,6)
+4 SET ARRAY(SEQ,"NUM")=NUM
+5 SET ARRAY(SEQ,"OP")=$SELECT(OP="A":"Add",OP="R":"Remove",OP="S":"Select",1:"")
IF $LENGTH(ARRAY(SEQ,"OP"))
SET ARRAY(SEQ,"OP")=ARRAY(SEQ,"OP")_" where:"
+6 SET EXT=$SELECT(EXT="A":"and",EXT="O":"or",1:"")
SET ARRAY(SEQ,"EXT")=$SELECT($LENGTH(EXT):EXT,1:"")
+7 SET ARRAY(SEQ,"FIELD")=$$VALUE^FSCGET(FIELD,7107.11,3)
+8 SET ARRAY(SEQ,"COND")=$$VALUE^FSCGET(COND,7107.11,4)
+9 SET ARRAY(SEQ,"VALUE")=$$NONDDV^FSCDD(VALUE,FIELD)
End DoDot:1
+10 QUIT
+11 ;
FORM(DEFNUM,ARRAY,LINECNT) ; from FSCLMM
+1 SET LINECNT=+$GET(LINECNT)
+2 NEW FORMAT,LINE,SEQ
+3 SET SEQ=0
FOR
SET SEQ=$ORDER(QUERY(SEQ))
if SEQ<1
QUIT
Begin DoDot:1
+4 IF (SEQ#10)=0
IF '$GET(FSCDEV)
WRITE "."
+5 DO SETTEXT^FSCFORM(1,SEQ,1,SEQ)
+6 DO SETTEXT^FSCFORM(1,SEQ,7,QUERY(SEQ,"OP"))
+7 DO SETTEXT^FSCFORM(1,SEQ,15,QUERY(SEQ,"EXT"))
+8 DO SETTEXT^FSCFORM(1,SEQ,25,QUERY(SEQ,"FIELD"))
+9 DO SETTEXT^FSCFORM(1,SEQ,38,QUERY(SEQ,"COND"))
+10 DO SETTEXT^FSCFORM(1,SEQ,45,QUERY(SEQ,"VALUE"))
End DoDot:1
+11 SET LINE=0
FOR
SET LINE=$ORDER(FORMAT(1,LINE))
if LINE<1
QUIT
Begin DoDot:1
+12 SET VALMCNT=VALMCNT+1
+13 SET ^TMP("FSC MODIFY LISTS",$JOB,VALMCNT,0)=FORMAT(1,LINE)
+14 SET ^TMP("FSC MODIFY LISTS",$JOB,"IDX",+FORMAT(1,LINE),VALMCNT)=""
End DoDot:1
+15 SET ^TMP("FSC MODIFY LISTS",$JOB)=+$GET(FORMAT(1,+$ORDER(FORMAT(1,"A"),-1)))
+16 QUIT