Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FSCRPCQ

FSCRPCQ.m

Go to the documentation of this file.
FSCRPCQ ;SLC/STAFF-NOIS RPC Query ;4/24/98  16:02
 ;;1.1;NOIS;;Sep 06, 1998
 ;
QUERY(IN,OUT) ; from FSCRPX (RPCQuery)
 N COUNT,CRITERIA,LISTCNT,MAX,NUM,OPNUM K CRITERIA
 K ^TMP("FSC LIST",$J),^TMP("FSC NEWLIST",$J),^TMP("FSC USELIST",$J),^TMP("FSC CRITERIA",$J)
 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
 D PROCESS
 S OPNUM=0 F  S OPNUM=$O(^TMP("FSC CRITERIA",$J,OPNUM)) Q:OPNUM<1  D
 .K CRITERIA M CRITERIA=^TMP("FSC CRITERIA",$J,OPNUM)
 .D OPTIMIZE^FSCQO(.CRITERIA)
 .D QUERY^FSCQR("",.LISTCNT,.CRITERIA)
 K ^TMP("FSC CURRENT LIST",$J)
 S COUNT=0,MAX=$$MAX^FSCRPCL
 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
 D OUTPUT^FSCRPCA
 K ^TMP("FSC LIST",$J),^TMP("FSC NEWLIST",$J),^TMP("FSC USELIST",$J),^TMP("FSC CRITERIA",$J)
 Q
 ;
PROCESS ;
 N COND,EXT,FLD,FLDCNT,LINE,NUM,OP,OPCNT,STEPCNT,VALUE
 S (OPCNT,STEPCNT,FLDCNT)=0
 S NUM=0 F  S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1  S LINE=^(NUM) I $L(LINE) D
 .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)
 .I COND="not exist" S COND="not exists" ;*** temp fix for gui
 .I $L(OP) S OPCNT=OPCNT+1,STEPCNT=1,FLDCNT=0,^TMP("FSC CRITERIA",$J,OPCNT,0)=OP_"^1^0"
 .I EXT="or" S STEPCNT=STEPCNT+1,FLDCNT=0,$P(^TMP("FSC CRITERIA",$J,OPCNT,0),U,2)=STEPCNT
 .S FLDCNT=FLDCNT+1,^TMP("FSC CRITERIA",$J,OPCNT,STEPCNT)=FLDCNT
 .S ^TMP("FSC CRITERIA",$J,OPCNT,STEPCNT,FLDCNT)=FLD_U_COND_U_VALUE
 .S ^TMP("FSC CRITERIA",$J,OPCNT,STEPCNT,FLDCNT,1)=EXT
 Q