SDQPROP ;ALB/MJK - Query Object Property Methods ;8/12/96
;;5.3;Scheduling;**131**;Aug 13, 1993
;
DATE(SDQ,SDBEG,SDEND,SDACT,SDERR) ; -- set/get date range property
; API ID: 82
; API NAME: SDQ DATE RANGE
;
DATEG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G DATEQ
IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G DATEQ
IF SDACT="SET",'$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) G DATEQ
IF SDACT="SET",SDBEG=0 S SDBEG=2900101
IF SDACT="SET",'$$RANGE^SDQVAL(.SDBEG,.SDEND,$G(SDERR)) G DATEQ
;
IF SDACT="SET" D
. S @SDQUERY@(SDQ,"BEGIN DATE")=SDBEG
. S @SDQUERY@(SDQ,"END DATE")=SDEND
IF SDACT="GET" D
. S SDBEG=$G(@SDQUERY@(SDQ,"BEGIN DATE"))
. S SDEND=$G(@SDQUERY@(SDQ,"END DATE"))
;
DATEQ Q
;
;
FILTER(SDQ,SDFIL,SDACT,SDERR) ; -- set/get filter property
; API ID: 83
; API NAME: SDQ FILTER
;
FILTERG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G FILTERQ
IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G FILTERQ
IF SDACT="SET",'$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) G FILTERQ
IF SDACT="SET",'$$FILTER^SDQVAL(.SDFIL,$G(SDERR)) G FILTERQ
;
IF SDACT="SET" S @SDQUERY@(SDQ,"FILTER")=SDFIL
IF SDACT="GET" S SDFIL=$G(@SDQUERY@(SDQ,"FILTER"),"IF 1")
;
FILTERQ Q
;
;
INDEX(SDQ,SDIDX,SDACT,SDERR) ; -- set/get index property
; API ID: 85
; API NAME: SDQ INDEX NAME
;
INDEXG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G INDEXQ
IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G INDEXQ
IF SDACT="SET",'$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) G INDEXQ
IF SDACT="SET",'$$INDEX^SDQVAL(.SDQ,.SDIDX,$G(SDERR)) G INDEXQ
;
IF SDACT="SET" D SETIDX(.SDQ,.SDIDX)
IF SDACT="GET" S SDIDX=$G(@SDQUERY@(SDQ,"INDEX EXTERNAL"))
;
INDEXQ Q
;
;
SETIDX(SDQ,SDIDX) ; -- set index related info
N SDIDXI,SDTYPE,SDVAL
S SDIDXI=$O(^TMP("SDQUERY CLASS",$J,SDQ,"INDEX","B",SDIDX,0))
S X=$G(^TMP("SDQUERY CLASS",$J,SDQ,"INDEX",SDIDXI,0))
S @SDQUERY@(SDQ,"INDEX EXTERNAL")=$P(X,"^",1)
S @SDQUERY@(SDQ,"INDEX INTERNAL")=$P(X,"^",2)
S (SDTYPE,@SDQUERY@(SDQ,"INDEX TYPE"))=$P(X,"^",3)
;
; -- at which subscript is ien located + subscripts in global root
S @SDQUERY@(SDQ,"IEN SUBSCRIPT")=$S(SDTYPE=1:3,SDTYPE=2:3,SDTYPE=4:4,1:999)+$P($G(^TMP("SDQUERY CLASS",$J,SDQ,"GL SUBSCRIPTS")),"^",3)
;
; -- get override entry validator if defined, otherwise use default
S SDVAL=$G(^TMP("SDQUERY CLASS",$J,SDQ,"INDEX",SDIDXI,"VALIDATOR"))
IF SDVAL="" D
. IF SDTYPE=1 S SDVAL="D REG^SDQUT(.SDQ,.SDGREF)" ; regular
. IF SDTYPE=2 S SDVAL="D REGDT^SDQUT(.SDQ,.SDGREF)" ; regular date range
. ; IF SDTYPE=3 S SDVAL="D COM^SDQUT(.SDQ,.SDGREF)" ; composite
. IF SDTYPE=4 S SDVAL="D COMDT^SDQUT(.SDQ,.SDGREF)" ; composite date range
;
S @SDQUERY@(SDQ,"VALIDATOR")=SDVAL
Q
;
;
ACTIVE(SDQ,SDSTAT,SDACT,SDERR) ; -- activate query
; API ID: 88
; API NAME: SDQ ACTIVE STATUS
;
ACTIVEG ; -- goto entry point
; -- do validation checks
IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G ACTIVEQ
IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G ACTIVEQ
;
; -- did above produce errors?
; -- if so, it's important to stop processing to prevent other errors
IF $G(SDERR)="",$O(^TMP("DIERR",$J,0)) G ACTIVEQ
IF $G(SDERR)]"",$O(@SDERR@("DIERR",0)) G ACTIVEQ
;
IF SDACT="SET" D G ACTIVEQ
. IF '$$STATUS^SDQVAL(.SDSTAT,$G(SDERR)) Q
. IF SDSTAT="TRUE",'$$PROP^SDQVAL(.SDQ,$G(SDERR)) Q
. IF SDSTAT="TRUE",'$G(@SDQUERY@(SDQ,"ACTIVE")) D START(.SDQ)
. IF SDSTAT="FALSE",$G(@SDQUERY@(SDQ,"ACTIVE")) D STOP(.SDQ)
;
IF SDACT="GET" D G ACTIVEQ
. S SDSTAT=$S(@SDQUERY@(SDQ,"ACTIVE"):"TRUE",1:"FALSE")
;
ACTIVEQ Q
;
;
START(SDQ) ; -- set up active query
N Y,SDTYPE,SDIDX,SDGL,SDMST,SDBEG
S SDTYPE=$G(@SDQUERY@(SDQ,"INDEX TYPE"))
S SDIDX=$G(@SDQUERY@(SDQ,"INDEX INTERNAL"))
S SDMST=$G(@SDQUERY@(SDQ,"MASTER VALUE"))
S SDBEG=$G(@SDQUERY@(SDQ,"BEGIN DATE"))
S SDGL=$G(^TMP("SDQUERY CLASS",$J,SDQ,"GL"))
S Y=""
;
IF SDTYPE=1 S Y=SDGL_""""_SDIDX_""","""_SDMST_""")" ; regular
IF SDTYPE=2 S Y=SDGL_""""_SDIDX_""","_(SDBEG-.000001)_")" ; regular d/t
IF SDTYPE=3 S Y=SDGL_""""_SDIDX_""","""_SDMST_""")" ; composite
IF SDTYPE=4 S Y=SDGL_""""_SDIDX_""","""_SDMST_""","_(SDBEG-.000001)_")" ; composite d/t
;
S @SDQUERY@(SDQ,"GLOBAL REF")=Y
S @SDQUERY@(SDQ,"CURSOR")=0
S @SDQUERY@(SDQ,"ACTIVE")=1
S @SDQUERY@(SDQ,"MORE")=1
S @SDQUERY@(SDQ,"BOF")=1
S @SDQUERY@(SDQ,"EOF")=0
S @SDQUERY@(SDQ,"COUNT")=0
K ^TMP("SDQUERY LIST",$J,SDQ)
D NEXT^SDQNAV(.SDQ,$G(SDERR))
STARTQ Q
;
;
STOP(SDQRY) ; -- stop query / also called from CREATE^SDQ to set up query
;
S @SDQUERY@(SDQ,"GLOBAL REF")=""
S @SDQUERY@(SDQ,"CURSOR")=0
S @SDQUERY@(SDQ,"ACTIVE")=0
S @SDQUERY@(SDQ,"MORE")=0
S @SDQUERY@(SDQ,"BOF")=0
S @SDQUERY@(SDQ,"COUNT")=0
K ^TMP("SDQUERY LIST",$J,SDQ)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDQPROP 4893 printed Oct 16, 2024@19:00:25 Page 2
SDQPROP ;ALB/MJK - Query Object Property Methods ;8/12/96
+1 ;;5.3;Scheduling;**131**;Aug 13, 1993
+2 ;
DATE(SDQ,SDBEG,SDEND,SDACT,SDERR) ; -- set/get date range property
+1 ; API ID: 82
+2 ; API NAME: SDQ DATE RANGE
+3 ;
DATEG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO DATEQ
+3 IF '$$ACTION^SDQVAL(.SDACT,$GET(SDERR))
GOTO DATEQ
+4 IF SDACT="SET"
IF '$$QRYINACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO DATEQ
+5 IF SDACT="SET"
IF SDBEG=0
SET SDBEG=2900101
+6 IF SDACT="SET"
IF '$$RANGE^SDQVAL(.SDBEG,.SDEND,$GET(SDERR))
GOTO DATEQ
+7 ;
+8 IF SDACT="SET"
Begin DoDot:1
+9 SET @SDQUERY@(SDQ,"BEGIN DATE")=SDBEG
+10 SET @SDQUERY@(SDQ,"END DATE")=SDEND
End DoDot:1
+11 IF SDACT="GET"
Begin DoDot:1
+12 SET SDBEG=$GET(@SDQUERY@(SDQ,"BEGIN DATE"))
+13 SET SDEND=$GET(@SDQUERY@(SDQ,"END DATE"))
End DoDot:1
+14 ;
DATEQ QUIT
+1 ;
+2 ;
FILTER(SDQ,SDFIL,SDACT,SDERR) ; -- set/get filter property
+1 ; API ID: 83
+2 ; API NAME: SDQ FILTER
+3 ;
FILTERG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO FILTERQ
+3 IF '$$ACTION^SDQVAL(.SDACT,$GET(SDERR))
GOTO FILTERQ
+4 IF SDACT="SET"
IF '$$QRYINACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO FILTERQ
+5 IF SDACT="SET"
IF '$$FILTER^SDQVAL(.SDFIL,$GET(SDERR))
GOTO FILTERQ
+6 ;
+7 IF SDACT="SET"
SET @SDQUERY@(SDQ,"FILTER")=SDFIL
+8 IF SDACT="GET"
SET SDFIL=$GET(@SDQUERY@(SDQ,"FILTER"),"IF 1")
+9 ;
FILTERQ QUIT
+1 ;
+2 ;
INDEX(SDQ,SDIDX,SDACT,SDERR) ; -- set/get index property
+1 ; API ID: 85
+2 ; API NAME: SDQ INDEX NAME
+3 ;
INDEXG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO INDEXQ
+3 IF '$$ACTION^SDQVAL(.SDACT,$GET(SDERR))
GOTO INDEXQ
+4 IF SDACT="SET"
IF '$$QRYINACT^SDQVAL(.SDQ,$GET(SDERR))
GOTO INDEXQ
+5 IF SDACT="SET"
IF '$$INDEX^SDQVAL(.SDQ,.SDIDX,$GET(SDERR))
GOTO INDEXQ
+6 ;
+7 IF SDACT="SET"
DO SETIDX(.SDQ,.SDIDX)
+8 IF SDACT="GET"
SET SDIDX=$GET(@SDQUERY@(SDQ,"INDEX EXTERNAL"))
+9 ;
INDEXQ QUIT
+1 ;
+2 ;
SETIDX(SDQ,SDIDX) ; -- set index related info
+1 NEW SDIDXI,SDTYPE,SDVAL
+2 SET SDIDXI=$ORDER(^TMP("SDQUERY CLASS",$JOB,SDQ,"INDEX","B",SDIDX,0))
+3 SET X=$GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"INDEX",SDIDXI,0))
+4 SET @SDQUERY@(SDQ,"INDEX EXTERNAL")=$PIECE(X,"^",1)
+5 SET @SDQUERY@(SDQ,"INDEX INTERNAL")=$PIECE(X,"^",2)
+6 SET (SDTYPE,@SDQUERY@(SDQ,"INDEX TYPE"))=$PIECE(X,"^",3)
+7 ;
+8 ; -- at which subscript is ien located + subscripts in global root
+9 SET @SDQUERY@(SDQ,"IEN SUBSCRIPT")=$SELECT(SDTYPE=1:3,SDTYPE=2:3,SDTYPE=4:4,1:999)+$PIECE($GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"GL SUBSCRIPTS")),"^",3)
+10 ;
+11 ; -- get override entry validator if defined, otherwise use default
+12 SET SDVAL=$GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"INDEX",SDIDXI,"VALIDATOR"))
+13 IF SDVAL=""
Begin DoDot:1
+14 ; regular
IF SDTYPE=1
SET SDVAL="D REG^SDQUT(.SDQ,.SDGREF)"
+15 ; regular date range
IF SDTYPE=2
SET SDVAL="D REGDT^SDQUT(.SDQ,.SDGREF)"
+16 ; IF SDTYPE=3 S SDVAL="D COM^SDQUT(.SDQ,.SDGREF)" ; composite
+17 ; composite date range
IF SDTYPE=4
SET SDVAL="D COMDT^SDQUT(.SDQ,.SDGREF)"
End DoDot:1
+18 ;
+19 SET @SDQUERY@(SDQ,"VALIDATOR")=SDVAL
+20 QUIT
+21 ;
+22 ;
ACTIVE(SDQ,SDSTAT,SDACT,SDERR) ; -- activate query
+1 ; API ID: 88
+2 ; API NAME: SDQ ACTIVE STATUS
+3 ;
ACTIVEG ; -- goto entry point
+1 ; -- do validation checks
+2 IF '$$QRY^SDQVAL(.SDQ,$GET(SDERR))
GOTO ACTIVEQ
+3 IF '$$ACTION^SDQVAL(.SDACT,$GET(SDERR))
GOTO ACTIVEQ
+4 ;
+5 ; -- did above produce errors?
+6 ; -- if so, it's important to stop processing to prevent other errors
+7 IF $GET(SDERR)=""
IF $ORDER(^TMP("DIERR",$JOB,0))
GOTO ACTIVEQ
+8 IF $GET(SDERR)]""
IF $ORDER(@SDERR@("DIERR",0))
GOTO ACTIVEQ
+9 ;
+10 IF SDACT="SET"
Begin DoDot:1
+11 IF '$$STATUS^SDQVAL(.SDSTAT,$GET(SDERR))
QUIT
+12 IF SDSTAT="TRUE"
IF '$$PROP^SDQVAL(.SDQ,$GET(SDERR))
QUIT
+13 IF SDSTAT="TRUE"
IF '$GET(@SDQUERY@(SDQ,"ACTIVE"))
DO START(.SDQ)
+14 IF SDSTAT="FALSE"
IF $GET(@SDQUERY@(SDQ,"ACTIVE"))
DO STOP(.SDQ)
End DoDot:1
GOTO ACTIVEQ
+15 ;
+16 IF SDACT="GET"
Begin DoDot:1
+17 SET SDSTAT=$SELECT(@SDQUERY@(SDQ,"ACTIVE"):"TRUE",1:"FALSE")
End DoDot:1
GOTO ACTIVEQ
+18 ;
ACTIVEQ QUIT
+1 ;
+2 ;
START(SDQ) ; -- set up active query
+1 NEW Y,SDTYPE,SDIDX,SDGL,SDMST,SDBEG
+2 SET SDTYPE=$GET(@SDQUERY@(SDQ,"INDEX TYPE"))
+3 SET SDIDX=$GET(@SDQUERY@(SDQ,"INDEX INTERNAL"))
+4 SET SDMST=$GET(@SDQUERY@(SDQ,"MASTER VALUE"))
+5 SET SDBEG=$GET(@SDQUERY@(SDQ,"BEGIN DATE"))
+6 SET SDGL=$GET(^TMP("SDQUERY CLASS",$JOB,SDQ,"GL"))
+7 SET Y=""
+8 ;
+9 ; regular
IF SDTYPE=1
SET Y=SDGL_""""_SDIDX_""","""_SDMST_""")"
+10 ; regular d/t
IF SDTYPE=2
SET Y=SDGL_""""_SDIDX_""","_(SDBEG-.000001)_")"
+11 ; composite
IF SDTYPE=3
SET Y=SDGL_""""_SDIDX_""","""_SDMST_""")"
+12 ; composite d/t
IF SDTYPE=4
SET Y=SDGL_""""_SDIDX_""","""_SDMST_""","_(SDBEG-.000001)_")"
+13 ;
+14 SET @SDQUERY@(SDQ,"GLOBAL REF")=Y
+15 SET @SDQUERY@(SDQ,"CURSOR")=0
+16 SET @SDQUERY@(SDQ,"ACTIVE")=1
+17 SET @SDQUERY@(SDQ,"MORE")=1
+18 SET @SDQUERY@(SDQ,"BOF")=1
+19 SET @SDQUERY@(SDQ,"EOF")=0
+20 SET @SDQUERY@(SDQ,"COUNT")=0
+21 KILL ^TMP("SDQUERY LIST",$JOB,SDQ)
+22 DO NEXT^SDQNAV(.SDQ,$GET(SDERR))
STARTQ QUIT
+1 ;
+2 ;
STOP(SDQRY) ; -- stop query / also called from CREATE^SDQ to set up query
+1 ;
+2 SET @SDQUERY@(SDQ,"GLOBAL REF")=""
+3 SET @SDQUERY@(SDQ,"CURSOR")=0
+4 SET @SDQUERY@(SDQ,"ACTIVE")=0
+5 SET @SDQUERY@(SDQ,"MORE")=0
+6 SET @SDQUERY@(SDQ,"BOF")=0
+7 SET @SDQUERY@(SDQ,"COUNT")=0
+8 KILL ^TMP("SDQUERY LIST",$JOB,SDQ)
+9 QUIT
+10 ;