source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDQVAL.m@ 1169

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

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1SDQVAL ;ALB/MJK - Query Object Validation Methods ;8/12/96
2 ;;5.3;Scheduling;**131**;Aug 13, 1993
3 ;
4QRY(SDQ,SDERR) ; -- validate query input
5 ;
6 ; -- do checks
7 IF SDQ,$D(@SDQUERY@(SDQ)) Q 1
8 ;
9 ; -- build error msg
10 N SDIN,SDOUT
11 S SDIN("QUERY")=SDQ
12 S SDOUT("QUERY")=SDQ
13 D BLD(4096800.101,.SDIN,.SDOUT,$G(SDERR))
14 Q 0
15 ;
16 ;
17QRYINACT(SDQ,SDMSG,SDERR) ; -- is query inactive?
18 ;
19 ; -- do checks
20 IF '$G(@SDQUERY@(SDQ,"ACTIVE")) Q 1
21 ;
22 ; -- build error msg indicating that query is active
23 N SDIN,SDOUT
24 S SDIN("QUERY")=SDQ
25 S SDOUT("QUERY")=SDQ
26 D BLD(4096800.106,.SDIN,.SDOUT,$G(SDERR))
27 Q 0
28 ;
29 ;
30QRYACT(SDQ,SDMSG,SDERR) ; -- is query active?
31 ;
32 ; -- do checks
33 IF $G(@SDQUERY@(SDQ,"ACTIVE")) Q 1
34 ;
35 ; -- build error msg indicating that query is inactive
36 N SDIN,SDOUT
37 S SDIN("QUERY")=SDQ
38 S SDOUT("QUERY")=SDQ
39 D BLD(4096800.102,.SDIN,.SDOUT,$G(SDERR))
40 Q 0
41 ;
42 ;
43ACTION(SDACT,SDERR) ; -- validate action input
44 ;
45 ; -- do checks
46 IF SDACT="SET"!(SDACT="GET") Q 1
47 ;
48 ; -- build error msg
49 N SDIN,SDOUT
50 S SDIN("ACTION")=SDACT
51 S SDOUT("ACTION")=SDACT
52 D BLD(4096800.108,.SDIN,.SDOUT,$G(SDERR))
53 Q 0
54 ;
55 ;
56FILTER(SDFIL,SDERR) ; -- validate filter input
57 N X
58 ;
59 ; -- do checks
60 ; S X=SDFIL D ^DIM IF $D(X) Q 1 ; -- bug in DIR/DIM combo
61 Q 1
62 ;
63 ; -- build error msg
64 N SDIN,SDOUT
65 S SDIN("FILTER")=SDFIL
66 S SDOUT("FILTER")=SDFIL
67 D BLD(4096800.104,.SDIN,.SDOUT,$G(SDERR))
68 Q 0
69 ;
70 ;
71INDEX(SDQ,SDIDX,SDERR) ; -- validate index input
72 ;
73 ; -- do checks
74 IF $O(^TMP("SDQUERY CLASS",$J,SDQ,"INDEX","B",SDIDX,0)) Q 1
75 ;
76 ; -- build error msg
77 N SDIN,SDOUT
78 S SDIN("INDEX")=SDIDX
79 S SDOUT("INDEX")=SDIDX
80 D BLD(4096800.105,.SDIN,.SDOUT,$G(SDERR))
81 Q 0
82 ;
83 ;
84STATUS(SDSTA,SDERR) ; -- validate active status
85 ;
86 ; -- do checks
87 IF SDSTA="TRUE"!(SDSTA="FALSE") Q 1
88 ;
89 ; -- build error msg
90 N SDIN,SDOUT
91 S SDIN("STATUS")=SDSTA
92 S SDOUT("STATUS")=SDSTA
93 D BLD(4096800.103,.SDIN,.SDOUT,$G(SDERR))
94 Q 0
95 ;
96 ;
97PAT(DFN,SDERR) ; -- validate DFN input
98 ;
99 ; -- do checks
100 IF DFN,$D(^DPT(DFN,0)) Q 1
101 ;
102 ; -- build error msg
103 N SDIN,SDOUT
104 S SDIN("ID")=DFN
105 S SDOUT("ID")=DFN
106 D BLD(4096800.002,.SDIN,.SDOUT,$G(SDERR))
107 Q 0
108 ;
109 ;
110RANGE(SDBEG,SDEND,SDERR) ; -- validate date range
111 ;
112 ; -- do checks
113 ; **** ADD MORE CHECKS HERE! ****
114 IF SDBEG,SDEND,SDBEG'>SDEND Q 1
115 ;
116 ; -- build error msg
117 N SDIN,SDOUT
118 S SDIN("BEGIN")=SDBEG
119 S SDIN("END")=SDEND
120 S SDOUT("BEGIN")=SDBEG
121 S SDOUT("END")=SDEND
122 D BLD(4096800.022,.SDIN,.SDOUT,$G(SDERR))
123 Q 0
124 ;
125 ;
126PROP(SDQ,SDERR) ; -- are properties set for execution
127 N SDTYPE,SDOK,SDPROP
128 S SDOK=1,SDPROP=""
129 S SDTYPE=+$G(@SDQUERY@(SDQ,"INDEX TYPE"))
130 ;
131 ; -- do checks
132 ; -- check if type is invalid
133 IF SDTYPE=0!(SDTYPE>4) D
134 . S SDOK=0
135 . S SDPROP=SDPROP_"INDEX / "
136 ;
137 ; -- if type is regular or composite date range
138 IF SDTYPE=1!(SDTYPE=4),$G(@SDQUERY@(SDQ,"MASTER VALUE"))="" D
139 . S SDOK=0
140 . S SDPROP=SDPROP_$G(@SDQUERY@(SDQ,"INDEX EXTERNAL"))_" / "
141 ;
142 ;
143 ; -- if type is regular date range or composite date range
144 IF SDTYPE=2!(SDTYPE=4) D
145 . IF $G(@SDQUERY@(SDQ,"BEGIN DATE"))="" D Q
146 . . S SDOK=0
147 . . S SDPROP=SDPROP_"BEGIN DATE / "
148 . ;
149 . IF $G(@SDQUERY@(SDQ,"END DATE"))="" D Q
150 . . S SDOK=0
151 . . S SDPROP=SDPROP_"END DATE / "
152 ;
153 ;
154 ; -- if type is composite (currently not supported [10/97])
155 IF SDTYPE=3 D
156 . S SDOK=0
157 . S SDPROP=SDPROP_"NO SUPPORTED / "
158 ;
159 ;
160 ; -- build error msg
161 IF 'SDOK D
162 . N SDIN,SDOUT
163 . S SDIN("PROPERTIES")=SDPROP
164 . S SDOUT("PROPERTIES")=SDPROP
165 . D BLD(4096800.109,.SDIN,.SDOUT,$G(SDERR))
166 ;
167PROPQ Q SDOK
168 ;
169 ;
170SCAN(SDQ,SDERR) ; -- is everything set up for SCAN to proceed?
171 ;
172 ; -- do checks
173 ; -- is callback defined
174 IF $G(@SDQUERY@(SDQ,"SCAN APP CALLBACK"))]"" Q 1
175 ;
176 ; -- build error msg
177 D BLD(4096800.112,"","",$G(SDERR))
178 Q 0
179 ;
180 ;
181SCANCB(SDCB,SDERR) ; -- is scan callback valid M code?
182 N X
183 ;
184 ; -- do checks
185 ;S X=SDCB D ^DIM IF $D(X) Q 1 ; -- bug in DIR/DIM combo
186 Q 1
187 ;
188 ; -- build error msg
189 N SDIN,SDOUT
190 S SDIN("CALLBACK")=SDCB
191 S SDOUT("CALLBACK")=SDCB
192 D BLD(4096800.113,.SDIN,.SDOUT,$G(SDERR))
193 Q 0
194 ;
195 ;
196BLD(SDMSG,SDIN,SDOUT,SDERR) ; -- build message
197 D BLD^DIALOG(SDMSG,.SDIN,.SDOUT,$G(SDERR),"F")
198 IF $G(SDEBUG) D
199 . D MSG^DIALOG("WES","","",5,$G(SDERR))
200 . N DIR
201 . S DIR(0)="E",DIR("A")="Press RETURN to continue"
202 . W ! D ^DIR
203 Q
204 ;
Note: See TracBrowser for help on using the repository browser.