[613] | 1 | FSCRPCQ ;SLC/STAFF-NOIS RPC Query ;4/24/98 16:02
|
---|
| 2 | ;;1.1;NOIS;;Sep 06, 1998
|
---|
| 3 | ;
|
---|
| 4 | QUERY(IN,OUT) ; from FSCRPX (RPCQuery)
|
---|
| 5 | N COUNT,CRITERIA,LISTCNT,MAX,NUM,OPNUM K CRITERIA
|
---|
| 6 | K ^TMP("FSC LIST",$J),^TMP("FSC NEWLIST",$J),^TMP("FSC USELIST",$J),^TMP("FSC CRITERIA",$J)
|
---|
| 7 | S (LISTCNT,CALL)=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 S ^TMP("FSC LIST",$J,CALL,0)=CALL,LISTCNT=LISTCNT+1
|
---|
| 8 | D PROCESS
|
---|
| 9 | S OPNUM=0 F S OPNUM=$O(^TMP("FSC CRITERIA",$J,OPNUM)) Q:OPNUM<1 D
|
---|
| 10 | .K CRITERIA M CRITERIA=^TMP("FSC CRITERIA",$J,OPNUM)
|
---|
| 11 | .D OPTIMIZE^FSCQO(.CRITERIA)
|
---|
| 12 | .D QUERY^FSCQR("",.LISTCNT,.CRITERIA)
|
---|
| 13 | K ^TMP("FSC CURRENT LIST",$J)
|
---|
| 14 | S COUNT=0,MAX=$$MAX^FSCRPCL
|
---|
| 15 | S NUM="A" F S NUM=$O(^TMP("FSC LIST",$J,NUM),-1) Q:NUM="" S CALL=+^(NUM,0) D SETUP^FSCRPCA(CALL,.COUNT) Q:COUNT>MAX
|
---|
| 16 | D OUTPUT^FSCRPCA
|
---|
| 17 | K ^TMP("FSC LIST",$J),^TMP("FSC NEWLIST",$J),^TMP("FSC USELIST",$J),^TMP("FSC CRITERIA",$J)
|
---|
| 18 | Q
|
---|
| 19 | ;
|
---|
| 20 | PROCESS ;
|
---|
| 21 | N COND,EXT,FLD,FLDCNT,LINE,NUM,OP,OPCNT,STEPCNT,VALUE
|
---|
| 22 | S (OPCNT,STEPCNT,FLDCNT)=0
|
---|
| 23 | S NUM=0 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) I $L(LINE) D
|
---|
| 24 | .S OP=$P(LINE,U),EXT=$P(LINE,U,2),FLD=$P(LINE,U,3),COND=$P(LINE,U,4),VALUE=$P(LINE,U,5,99)
|
---|
| 25 | .I COND="not exist" S COND="not exists" ;*** temp fix for gui
|
---|
| 26 | .I $L(OP) S OPCNT=OPCNT+1,STEPCNT=1,FLDCNT=0,^TMP("FSC CRITERIA",$J,OPCNT,0)=OP_"^1^0"
|
---|
| 27 | .I EXT="or" S STEPCNT=STEPCNT+1,FLDCNT=0,$P(^TMP("FSC CRITERIA",$J,OPCNT,0),U,2)=STEPCNT
|
---|
| 28 | .S FLDCNT=FLDCNT+1,^TMP("FSC CRITERIA",$J,OPCNT,STEPCNT)=FLDCNT
|
---|
| 29 | .S ^TMP("FSC CRITERIA",$J,OPCNT,STEPCNT,FLDCNT)=FLD_U_COND_U_VALUE
|
---|
| 30 | .S ^TMP("FSC CRITERIA",$J,OPCNT,STEPCNT,FLDCNT,1)=EXT
|
---|
| 31 | Q
|
---|