source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDQPROP.m@ 824

Last change on this file since 824 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.6 KB
Line 
1SDQPROP ;ALB/MJK - Query Object Property Methods ;8/12/96
2 ;;5.3;Scheduling;**131**;Aug 13, 1993
3 ;
4DATE(SDQ,SDBEG,SDEND,SDACT,SDERR) ; -- set/get date range property
5 ; API ID: 82
6 ; API NAME: SDQ DATE RANGE
7 ;
8DATEG ; -- goto entry point
9 ; -- do validation checks
10 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G DATEQ
11 IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G DATEQ
12 IF SDACT="SET",'$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) G DATEQ
13 IF SDACT="SET",SDBEG=0 S SDBEG=2900101
14 IF SDACT="SET",'$$RANGE^SDQVAL(.SDBEG,.SDEND,$G(SDERR)) G DATEQ
15 ;
16 IF SDACT="SET" D
17 . S @SDQUERY@(SDQ,"BEGIN DATE")=SDBEG
18 . S @SDQUERY@(SDQ,"END DATE")=SDEND
19 IF SDACT="GET" D
20 . S SDBEG=$G(@SDQUERY@(SDQ,"BEGIN DATE"))
21 . S SDEND=$G(@SDQUERY@(SDQ,"END DATE"))
22 ;
23DATEQ Q
24 ;
25 ;
26FILTER(SDQ,SDFIL,SDACT,SDERR) ; -- set/get filter property
27 ; API ID: 83
28 ; API NAME: SDQ FILTER
29 ;
30FILTERG ; -- goto entry point
31 ; -- do validation checks
32 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G FILTERQ
33 IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G FILTERQ
34 IF SDACT="SET",'$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) G FILTERQ
35 IF SDACT="SET",'$$FILTER^SDQVAL(.SDFIL,$G(SDERR)) G FILTERQ
36 ;
37 IF SDACT="SET" S @SDQUERY@(SDQ,"FILTER")=SDFIL
38 IF SDACT="GET" S SDFIL=$G(@SDQUERY@(SDQ,"FILTER"),"IF 1")
39 ;
40FILTERQ Q
41 ;
42 ;
43INDEX(SDQ,SDIDX,SDACT,SDERR) ; -- set/get index property
44 ; API ID: 85
45 ; API NAME: SDQ INDEX NAME
46 ;
47INDEXG ; -- goto entry point
48 ; -- do validation checks
49 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G INDEXQ
50 IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G INDEXQ
51 IF SDACT="SET",'$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) G INDEXQ
52 IF SDACT="SET",'$$INDEX^SDQVAL(.SDQ,.SDIDX,$G(SDERR)) G INDEXQ
53 ;
54 IF SDACT="SET" D SETIDX(.SDQ,.SDIDX)
55 IF SDACT="GET" S SDIDX=$G(@SDQUERY@(SDQ,"INDEX EXTERNAL"))
56 ;
57INDEXQ Q
58 ;
59 ;
60SETIDX(SDQ,SDIDX) ; -- set index related info
61 N SDIDXI,SDTYPE,SDVAL
62 S SDIDXI=$O(^TMP("SDQUERY CLASS",$J,SDQ,"INDEX","B",SDIDX,0))
63 S X=$G(^TMP("SDQUERY CLASS",$J,SDQ,"INDEX",SDIDXI,0))
64 S @SDQUERY@(SDQ,"INDEX EXTERNAL")=$P(X,"^",1)
65 S @SDQUERY@(SDQ,"INDEX INTERNAL")=$P(X,"^",2)
66 S (SDTYPE,@SDQUERY@(SDQ,"INDEX TYPE"))=$P(X,"^",3)
67 ;
68 ; -- at which subscript is ien located + subscripts in global root
69 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)
70 ;
71 ; -- get override entry validator if defined, otherwise use default
72 S SDVAL=$G(^TMP("SDQUERY CLASS",$J,SDQ,"INDEX",SDIDXI,"VALIDATOR"))
73 IF SDVAL="" D
74 . IF SDTYPE=1 S SDVAL="D REG^SDQUT(.SDQ,.SDGREF)" ; regular
75 . IF SDTYPE=2 S SDVAL="D REGDT^SDQUT(.SDQ,.SDGREF)" ; regular date range
76 . ; IF SDTYPE=3 S SDVAL="D COM^SDQUT(.SDQ,.SDGREF)" ; composite
77 . IF SDTYPE=4 S SDVAL="D COMDT^SDQUT(.SDQ,.SDGREF)" ; composite date range
78 ;
79 S @SDQUERY@(SDQ,"VALIDATOR")=SDVAL
80 Q
81 ;
82 ;
83ACTIVE(SDQ,SDSTAT,SDACT,SDERR) ; -- activate query
84 ; API ID: 88
85 ; API NAME: SDQ ACTIVE STATUS
86 ;
87ACTIVEG ; -- goto entry point
88 ; -- do validation checks
89 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G ACTIVEQ
90 IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G ACTIVEQ
91 ;
92 ; -- did above produce errors?
93 ; -- if so, it's important to stop processing to prevent other errors
94 IF $G(SDERR)="",$O(^TMP("DIERR",$J,0)) G ACTIVEQ
95 IF $G(SDERR)]"",$O(@SDERR@("DIERR",0)) G ACTIVEQ
96 ;
97 IF SDACT="SET" D G ACTIVEQ
98 . IF '$$STATUS^SDQVAL(.SDSTAT,$G(SDERR)) Q
99 . IF SDSTAT="TRUE",'$$PROP^SDQVAL(.SDQ,$G(SDERR)) Q
100 . IF SDSTAT="TRUE",'$G(@SDQUERY@(SDQ,"ACTIVE")) D START(.SDQ)
101 . IF SDSTAT="FALSE",$G(@SDQUERY@(SDQ,"ACTIVE")) D STOP(.SDQ)
102 ;
103 IF SDACT="GET" D G ACTIVEQ
104 . S SDSTAT=$S(@SDQUERY@(SDQ,"ACTIVE"):"TRUE",1:"FALSE")
105 ;
106ACTIVEQ Q
107 ;
108 ;
109START(SDQ) ; -- set up active query
110 N Y,SDTYPE,SDIDX,SDGL,SDMST,SDBEG
111 S SDTYPE=$G(@SDQUERY@(SDQ,"INDEX TYPE"))
112 S SDIDX=$G(@SDQUERY@(SDQ,"INDEX INTERNAL"))
113 S SDMST=$G(@SDQUERY@(SDQ,"MASTER VALUE"))
114 S SDBEG=$G(@SDQUERY@(SDQ,"BEGIN DATE"))
115 S SDGL=$G(^TMP("SDQUERY CLASS",$J,SDQ,"GL"))
116 S Y=""
117 ;
118 IF SDTYPE=1 S Y=SDGL_""""_SDIDX_""","""_SDMST_""")" ; regular
119 IF SDTYPE=2 S Y=SDGL_""""_SDIDX_""","_(SDBEG-.000001)_")" ; regular d/t
120 IF SDTYPE=3 S Y=SDGL_""""_SDIDX_""","""_SDMST_""")" ; composite
121 IF SDTYPE=4 S Y=SDGL_""""_SDIDX_""","""_SDMST_""","_(SDBEG-.000001)_")" ; composite d/t
122 ;
123 S @SDQUERY@(SDQ,"GLOBAL REF")=Y
124 S @SDQUERY@(SDQ,"CURSOR")=0
125 S @SDQUERY@(SDQ,"ACTIVE")=1
126 S @SDQUERY@(SDQ,"MORE")=1
127 S @SDQUERY@(SDQ,"BOF")=1
128 S @SDQUERY@(SDQ,"EOF")=0
129 S @SDQUERY@(SDQ,"COUNT")=0
130 K ^TMP("SDQUERY LIST",$J,SDQ)
131 D NEXT^SDQNAV(.SDQ,$G(SDERR))
132STARTQ Q
133 ;
134 ;
135STOP(SDQRY) ; -- stop query / also called from CREATE^SDQ to set up query
136 ;
137 S @SDQUERY@(SDQ,"GLOBAL REF")=""
138 S @SDQUERY@(SDQ,"CURSOR")=0
139 S @SDQUERY@(SDQ,"ACTIVE")=0
140 S @SDQUERY@(SDQ,"MORE")=0
141 S @SDQUERY@(SDQ,"BOF")=0
142 S @SDQUERY@(SDQ,"COUNT")=0
143 K ^TMP("SDQUERY LIST",$J,SDQ)
144 Q
145 ;
Note: See TracBrowser for help on using the repository browser.