SDQNAV ;ALB/MJK - Query Object Navigation Methods ;8/12/96
;;5.3;Scheduling;**131,1015**;Aug 13, 1993;Build 21
;
SCAN(SDQ,SDIR,SDERR) ; -- scan all records
; API ID: 99
; API NAME: SDQ SCAN
;
SCANG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G SCANQ
IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G SCANQ
IF '$$SCAN^SDQVAL(.SDQ,$G(SDERR)) G SCANQ
;
N SDSCAN
S SDSCAN=$G(@SDQUERY@(SDQ,"SCAN"))
IF SDSCAN]"" X SDSCAN
SCANQ Q
;
;
SCANCB(SDQ,SDCB,SDACT,SDERR) ; -- set/get scan callback method
; API ID: 100
; API NAME: SDQ SCAN CALLBACK
;
SCANCBG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G SCANCBQ
IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G SCANCBQ
;
IF SDACT="SET" D
. IF '$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) Q
. IF '$$SCANCB^SDQVAL(.SDCB,$G(SDERR)) Q
. S @SDQUERY@(SDQ,"SCAN APP CALLBACK")=SDCB
;
IF SDACT="GET" S SDCB=$G(@SDQUERY@(SDQ,"SCAN APP CALLBACK"),"QUIT")
SCANCBQ Q
;
;
NEXT(SDQ,SDERR) ; -- get next global ref
; API ID: 92
; API NAME: SDQ NEXT
;
NEXTG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G NEXTQ
IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G NEXTQ
IF $G(@SDQUERY@(SDQ,"EOF")) D BLD^SDQVAL(4096800.111,"","",$G(SDERR)) G NEXTQ
;
N SDNEXT
S SDNEXT=$O(^TMP("SDQUERY LIST",$J,SDQ,+$G(@SDQUERY@(SDQ,"CURSOR"))),1)
;
IF SDNEXT D G NEXTQ
. S @SDQUERY@(SDQ,"CURSOR")=SDNEXT
. S @SDQUERY@(SDQ,"BOF")=0
. S @SDQUERY@(SDQ,"EOF")=0
;
; -- get initial ref value and also save for compares
N SDGREF,SDSAVE
S (SDGREF,SDSAVE)=$G(@SDQUERY@(SDQ,"GLOBAL REF"))
D CHECK(.SDQ,.SDGREF,.SDSAVE)
;
IF SDGREF'="" D G NEXTQ
. S @SDQUERY@(SDQ,"GLOBAL REF")=SDGREF
. S SDCNT=+$G(@SDQUERY@(SDQ,"COUNT"))
. S SDCNT=SDCNT+1
. S @SDQUERY@(SDQ,"COUNT")=SDCNT
. S @SDQUERY@(SDQ,"CURSOR")=SDCNT
. S ^TMP("SDQUERY LIST",$J,SDQ,SDCNT)=SDGREF
. S @SDQUERY@(SDQ,"MORE")=1
. S @SDQUERY@(SDQ,"BOF")=0
. S @SDQUERY@(SDQ,"EOF")=0
ELSE D
. S @SDQUERY@(SDQ,"MORE")=0
. S @SDQUERY@(SDQ,"EOF")=1
NEXTQ Q
;
;
CHECK(SDQ,SDGREF,SDSAVE) ; -- check if ok
N SDFIL,SDVAL
S SDFIL=$G(@SDQUERY@(SDQ,"FILTER"))
S SDVAL=$G(@SDQUERY@(SDQ,"VALIDATOR"))
;
F S SDGREF=$Q(@SDSAVE) Q:SDGREF="" X SDVAL Q:SDGREF="" D Q:SDGREF'=""
. S SDSAVE=SDGREF
. IF SDFIL="" Q
. IF '$$FILTER(.SDQ,.SDGREF,.SDFIL) S SDGREF=""
Q
;
FILTER(SDQ,SDGREF,SDFIL) ; -- perform filter logic
N Y,Y0,SDNODE,SDSUB,SDZERO
S SDSUB=+$G(@SDQUERY@(SDQ,"IEN SUBSCRIPT"))
S SDZERO=$G(^TMP("SDQUERY CLASS",$J,SDQ,"ZERO"))
S Y=$QS(SDGREF,SDSUB)
IF SDZERO]"" D
. X SDZERO
ELSE D
. S SDNODE=$G(^TMP("SDQUERY CLASS",$J,SDQ,"GL"))_Y_",0)"
. S Y0=$G(@SDNODE)
X SDFIL
Q $T
;
;
PRIOR(SDQ,SDERR) ; -- get prior global ref
; API ID: 93
; API NAME: SDQ PRIOR
;
PRIORG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G PRIORQ
IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G PRIORQ
IF $G(@SDQUERY@(SDQ,"BOF")) D BLD^SDQVAL(4096800.11,"","",$G(SDERR)) G PRIORQ
;
N SDCUR,SDPRIOR
S SDCUR=+$G(@SDQUERY@(SDQ,"CURSOR"))
S SDPRIOR=$O(^TMP("SDQUERY LIST",$J,SDQ,SDCUR),-1)
;
IF SDPRIOR D G PRIORQ
. S @SDQUERY@(SDQ,"CURSOR")=SDPRIOR
. S @SDQUERY@(SDQ,"BOF")=0
. S @SDQUERY@(SDQ,"EOF")=0
ELSE D
. S @SDQUERY@(SDQ,"BOF")=1
PRIORQ Q
;
;
FIRST(SDQ,SDERR) ; -- get first entry
; API ID: 90
; API NAME: SDQ FIRST
;
FIRSTG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G FIRSTQ
IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G FIRSTQ
;
S @SDQUERY@(SDQ,"CURSOR")=+$O(^TMP("SDQUERY LIST",$J,SDQ,0),1)
S @SDQUERY@(SDQ,"BOF")=1
S @SDQUERY@(SDQ,"EOF")=(@SDQUERY@(SDQ,"CURSOR")=0)
FIRSTQ Q
;
;
LAST(SDQ,SDERR) ; -- get last entry
; API ID: 91
; API NAME: SDQ LAST
;
LASTG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G LASTQ
IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G LASTQ
;
IF $G(@SDQUERY@(SDQ,"MORE")) D GETREST(.SDQ,$G(SDERR))
S @SDQUERY@(SDQ,"CURSOR")=+$O(^TMP("SDQUERY LIST",$J,SDQ,""),-1)
S @SDQUERY@(SDQ,"BOF")=(@SDQUERY@(SDQ,"CURSOR")=0)
S @SDQUERY@(SDQ,"EOF")=1
LASTQ Q
;
;
EOF(SDQ,SDERR) ; -- at end of file
; API ID: 86
; API NAME: SDQ EOF
;
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) Q 0
IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) Q 0
;
EOFQ Q $G(@SDQUERY@(SDQ,"EOF"))
;
;
BOF(SDQ,SDERR) ; -- at beginning of file
; API ID: 87
; API NAME: SDQ BOF
;
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) Q 0
IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) Q 0
;
BOFQ Q $G(@SDQUERY@(SDQ,"BOF"))
;
;
COUNT(SDQ,SDERR) ; -- get entries count
; API ID: 89
; API NAME: SDQ COUNT
;
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) Q ""
IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) Q ""
;
IF $G(@SDQUERY@(SDQ,"MORE")) D GETREST(.SDQ,$G(SDERR))
Q +$G(@SDQUERY@(SDQ,"COUNT"))
;
;
GETREST(SDQ,SDERR) ; -- get rest of entries
;
F Q:'$G(@SDQUERY@(SDQ,"MORE")) D NEXT(.SDQ,$G(SDERR))
Q
;
SDQNAV ;ALB/MJK - Query Object Navigation Methods ;8/12/96
+1 ;;5.3;Scheduling;**131,1015**;Aug 13, 1993;Build 21
+2 ;
SCAN(SDQ,SDIR,SDERR) ; -- scan all records
+1 ; API ID: 99
+2 ; API NAME: SDQ SCAN
+3 ;
SCANG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO SCANQ
+3 IF '$$QRYACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO SCANQ
+4 IF '$$SCAN^SDQVAL(.SDQ,$GET(SDERR))
GOTO SCANQ
+5 ;
+6 NEW SDSCAN
+7 SET SDSCAN=$GET(@SDQUERY@(SDQ,"SCAN"))
+8 IF SDSCAN]""
XECUTE SDSCAN
SCANQ QUIT
+1 ;
+2 ;
SCANCB(SDQ,SDCB,SDACT,SDERR) ; -- set/get scan callback method
+1 ; API ID: 100
+2 ; API NAME: SDQ SCAN CALLBACK
+3 ;
SCANCBG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO SCANCBQ
+3 IF '$$ACTION^SDQVAL(.SDACT,$GET(SDERR))
GOTO SCANCBQ
+4 ;
+5 IF SDACT="SET"
Begin DoDot:1
+6 IF '$$QRYINACT^SDQVAL(.SDQ,$GET(SDERR))
QUIT
+7 IF '$$SCANCB^SDQVAL(.SDCB,$GET(SDERR))
QUIT
+8 SET @SDQUERY@(SDQ,"SCAN APP CALLBACK")=SDCB
End DoDot:1
+9 ;
+10 IF SDACT="GET"
SET SDCB=$GET(@SDQUERY@(SDQ,"SCAN APP CALLBACK"),"QUIT")
SCANCBQ QUIT
+1 ;
+2 ;
NEXT(SDQ,SDERR) ; -- get next global ref
+1 ; API ID: 92
+2 ; API NAME: SDQ NEXT
+3 ;
NEXTG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO NEXTQ
+3 IF '$$QRYACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO NEXTQ
+4 IF $GET(@SDQUERY@(SDQ,"EOF"))
DO BLD^SDQVAL(4096800.111,"","",$GET(SDERR))
GOTO NEXTQ
+5 ;
+6 NEW SDNEXT
+7 SET SDNEXT=$ORDER(^TMP("SDQUERY LIST",$JOB,SDQ,+$GET(@SDQUERY@(SDQ,"CURSOR"))),1)
+8 ;
+9 IF SDNEXT
Begin DoDot:1
+10 SET @SDQUERY@(SDQ,"CURSOR")=SDNEXT
+11 SET @SDQUERY@(SDQ,"BOF")=0
+12 SET @SDQUERY@(SDQ,"EOF")=0
End DoDot:1
GOTO NEXTQ
+13 ;
+14 ; -- get initial ref value and also save for compares
+15 NEW SDGREF,SDSAVE
+16 SET (SDGREF,SDSAVE)=$GET(@SDQUERY@(SDQ,"GLOBAL REF"))
+17 DO CHECK(.SDQ,.SDGREF,.SDSAVE)
+18 ;
+19 IF SDGREF'=""
Begin DoDot:1
+20 SET @SDQUERY@(SDQ,"GLOBAL REF")=SDGREF
+21 SET SDCNT=+$GET(@SDQUERY@(SDQ,"COUNT"))
+22 SET SDCNT=SDCNT+1
+23 SET @SDQUERY@(SDQ,"COUNT")=SDCNT
+24 SET @SDQUERY@(SDQ,"CURSOR")=SDCNT
+25 SET ^TMP("SDQUERY LIST",$JOB,SDQ,SDCNT)=SDGREF
+26 SET @SDQUERY@(SDQ,"MORE")=1
+27 SET @SDQUERY@(SDQ,"BOF")=0
+28 SET @SDQUERY@(SDQ,"EOF")=0
End DoDot:1
GOTO NEXTQ
+29 IF '$TEST
Begin DoDot:1
+30 SET @SDQUERY@(SDQ,"MORE")=0
+31 SET @SDQUERY@(SDQ,"EOF")=1
End DoDot:1
NEXTQ QUIT
+1 ;
+2 ;
CHECK(SDQ,SDGREF,SDSAVE) ; -- check if ok
+1 NEW SDFIL,SDVAL
+2 SET SDFIL=$GET(@SDQUERY@(SDQ,"FILTER"))
+3 SET SDVAL=$GET(@SDQUERY@(SDQ,"VALIDATOR"))
+4 ;
+5 FOR
SET SDGREF=$QUERY(@SDSAVE)
IF SDGREF=""
QUIT
XECUTE SDVAL
IF SDGREF=""
QUIT
Begin DoDot:1
+6 SET SDSAVE=SDGREF
+7 IF SDFIL=""
QUIT
+8 IF '$$FILTER(.SDQ,.SDGREF,.SDFIL)
SET SDGREF=""
End DoDot:1
IF SDGREF'=""
QUIT
+9 QUIT
+10 ;
FILTER(SDQ,SDGREF,SDFIL) ; -- perform filter logic
+1 NEW Y,Y0,SDNODE,SDSUB,SDZERO
+2 SET SDSUB=+$GET(@SDQUERY@(SDQ,"IEN SUBSCRIPT"))
+3 SET SDZERO=$GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"ZERO"))
+4 SET Y=$QSUBSCRIPT(SDGREF,SDSUB)
+5 IF SDZERO]""
Begin DoDot:1
+6 XECUTE SDZERO
End DoDot:1
+7 IF '$TEST
Begin DoDot:1
+8 SET SDNODE=$GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"GL"))_Y_",0)"
+9 SET Y0=$GET(@SDNODE)
End DoDot:1
+10 XECUTE SDFIL
+11 QUIT $TEST
+12 ;
+13 ;
PRIOR(SDQ,SDERR) ; -- get prior global ref
+1 ; API ID: 93
+2 ; API NAME: SDQ PRIOR
+3 ;
PRIORG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO PRIORQ
+3 IF '$$QRYACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO PRIORQ
+4 IF $GET(@SDQUERY@(SDQ,"BOF"))
DO BLD^SDQVAL(4096800.11,"","",$GET(SDERR))
GOTO PRIORQ
+5 ;
+6 NEW SDCUR,SDPRIOR
+7 SET SDCUR=+$GET(@SDQUERY@(SDQ,"CURSOR"))
+8 SET SDPRIOR=$ORDER(^TMP("SDQUERY LIST",$JOB,SDQ,SDCUR),-1)
+9 ;
+10 IF SDPRIOR
Begin DoDot:1
+11 SET @SDQUERY@(SDQ,"CURSOR")=SDPRIOR
+12 SET @SDQUERY@(SDQ,"BOF")=0
+13 SET @SDQUERY@(SDQ,"EOF")=0
End DoDot:1
GOTO PRIORQ
+14 IF '$TEST
Begin DoDot:1
+15 SET @SDQUERY@(SDQ,"BOF")=1
End DoDot:1
PRIORQ QUIT
+1 ;
+2 ;
FIRST(SDQ,SDERR) ; -- get first entry
+1 ; API ID: 90
+2 ; API NAME: SDQ FIRST
+3 ;
FIRSTG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO FIRSTQ
+3 IF '$$QRYACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO FIRSTQ
+4 ;
+5 SET @SDQUERY@(SDQ,"CURSOR")=+$ORDER(^TMP("SDQUERY LIST",$JOB,SDQ,0),1)
+6 SET @SDQUERY@(SDQ,"BOF")=1
+7 SET @SDQUERY@(SDQ,"EOF")=(@SDQUERY@(SDQ,"CURSOR")=0)
FIRSTQ QUIT
+1 ;
+2 ;
LAST(SDQ,SDERR) ; -- get last entry
+1 ; API ID: 91
+2 ; API NAME: SDQ LAST
+3 ;
LASTG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO LASTQ
+3 IF '$$QRYACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO LASTQ
+4 ;
+5 IF $GET(@SDQUERY@(SDQ,"MORE"))
DO GETREST(.SDQ,$GET(SDERR))
+6 SET @SDQUERY@(SDQ,"CURSOR")=+$ORDER(^TMP("SDQUERY LIST",$JOB,SDQ,""),-1)
+7 SET @SDQUERY@(SDQ,"BOF")=(@SDQUERY@(SDQ,"CURSOR")=0)
+8 SET @SDQUERY@(SDQ,"EOF")=1
LASTQ QUIT
+1 ;
+2 ;
EOF(SDQ,SDERR) ; -- at end of file
+1 ; API ID: 86
+2 ; API NAME: SDQ EOF
+3 ;
+4 ; -- do validation checks
+5 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
QUIT 0
+6 IF '$$QRYACT^SDQVAL(.SDQ,$GET(SDERR))
QUIT 0
+7 ;
EOFQ QUIT $GET(@SDQUERY@(SDQ,"EOF"))
+1 ;
+2 ;
BOF(SDQ,SDERR) ; -- at beginning of file
+1 ; API ID: 87
+2 ; API NAME: SDQ BOF
+3 ;
+4 ; -- do validation checks
+5 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
QUIT 0
+6 IF '$$QRYACT^SDQVAL(.SDQ,$GET(SDERR))
QUIT 0
+7 ;
BOFQ QUIT $GET(@SDQUERY@(SDQ,"BOF"))
+1 ;
+2 ;
COUNT(SDQ,SDERR) ; -- get entries count
+1 ; API ID: 89
+2 ; API NAME: SDQ COUNT
+3 ;
+4 ; -- do validation checks
+5 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
QUIT ""
+6 IF '$$QRYACT^SDQVAL(.SDQ,$GET(SDERR))
QUIT ""
+7 ;
+8 IF $GET(@SDQUERY@(SDQ,"MORE"))
DO GETREST(.SDQ,$GET(SDERR))
+9 QUIT +$GET(@SDQUERY@(SDQ,"COUNT"))
+10 ;
+11 ;
GETREST(SDQ,SDERR) ; -- get rest of entries
+1 ;
+2 FOR
IF '$GET(@SDQUERY@(SDQ,"MORE"))
QUIT
DO NEXT(.SDQ,$GET(SDERR))
+3 QUIT
+4 ;