source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SDQNAV.m@ 736

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

initial load of FOIAVistA 6/30/08 version

File size: 4.8 KB
Line 
1SDQNAV ;ALB/MJK - Query Object Navigation Methods ;8/12/96
2 ;;5.3;Scheduling;**131**;Aug 13, 1993
3 ;
4SCAN(SDQ,SDIR,SDERR) ; -- scan all records
5 ; API ID: 99
6 ; API NAME: SDQ SCAN
7 ;
8SCANG ; -- goto entry point
9 ; -- do validation checks
10 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G SCANQ
11 IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G SCANQ
12 IF '$$SCAN^SDQVAL(.SDQ,$G(SDERR)) G SCANQ
13 ;
14 N SDSCAN
15 S SDSCAN=$G(@SDQUERY@(SDQ,"SCAN"))
16 IF SDSCAN]"" X SDSCAN
17SCANQ Q
18 ;
19 ;
20SCANCB(SDQ,SDCB,SDACT,SDERR) ; -- set/get scan callback method
21 ; API ID: 100
22 ; API NAME: SDQ SCAN CALLBACK
23 ;
24SCANCBG ; -- goto entry point
25 ; -- do validation checks
26 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G SCANCBQ
27 IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G SCANCBQ
28 ;
29 IF SDACT="SET" D
30 . IF '$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) Q
31 . IF '$$SCANCB^SDQVAL(.SDCB,$G(SDERR)) Q
32 . S @SDQUERY@(SDQ,"SCAN APP CALLBACK")=SDCB
33 ;
34 IF SDACT="GET" S SDCB=$G(@SDQUERY@(SDQ,"SCAN APP CALLBACK"),"QUIT")
35SCANCBQ Q
36 ;
37 ;
38NEXT(SDQ,SDERR) ; -- get next global ref
39 ; API ID: 92
40 ; API NAME: SDQ NEXT
41 ;
42NEXTG ; -- goto entry point
43 ; -- do validation checks
44 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G NEXTQ
45 IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G NEXTQ
46 IF $G(@SDQUERY@(SDQ,"EOF")) D BLD^SDQVAL(4096800.111,"","",$G(SDERR)) G NEXTQ
47 ;
48 N SDNEXT
49 S SDNEXT=$O(^TMP("SDQUERY LIST",$J,SDQ,+$G(@SDQUERY@(SDQ,"CURSOR"))),1)
50 ;
51 IF SDNEXT D G NEXTQ
52 . S @SDQUERY@(SDQ,"CURSOR")=SDNEXT
53 . S @SDQUERY@(SDQ,"BOF")=0
54 . S @SDQUERY@(SDQ,"EOF")=0
55 ;
56 ; -- get initial ref value and also save for compares
57 N SDGREF,SDSAVE
58 S (SDGREF,SDSAVE)=$G(@SDQUERY@(SDQ,"GLOBAL REF"))
59 D CHECK(.SDQ,.SDGREF,.SDSAVE)
60 ;
61 IF SDGREF'="" D G NEXTQ
62 . S @SDQUERY@(SDQ,"GLOBAL REF")=SDGREF
63 . S SDCNT=+$G(@SDQUERY@(SDQ,"COUNT"))
64 . S SDCNT=SDCNT+1
65 . S @SDQUERY@(SDQ,"COUNT")=SDCNT
66 . S @SDQUERY@(SDQ,"CURSOR")=SDCNT
67 . S ^TMP("SDQUERY LIST",$J,SDQ,SDCNT)=SDGREF
68 . S @SDQUERY@(SDQ,"MORE")=1
69 . S @SDQUERY@(SDQ,"BOF")=0
70 . S @SDQUERY@(SDQ,"EOF")=0
71 ELSE D
72 . S @SDQUERY@(SDQ,"MORE")=0
73 . S @SDQUERY@(SDQ,"EOF")=1
74NEXTQ Q
75 ;
76 ;
77CHECK(SDQ,SDGREF,SDSAVE) ; -- check if ok
78 N SDFIL,SDVAL
79 S SDFIL=$G(@SDQUERY@(SDQ,"FILTER"))
80 S SDVAL=$G(@SDQUERY@(SDQ,"VALIDATOR"))
81 ;
82 F S SDGREF=$Q(@SDSAVE) Q:SDGREF="" X SDVAL Q:SDGREF="" D Q:SDGREF'=""
83 . S SDSAVE=SDGREF
84 . IF SDFIL="" Q
85 . IF '$$FILTER(.SDQ,.SDGREF,.SDFIL) S SDGREF=""
86 Q
87 ;
88FILTER(SDQ,SDGREF,SDFIL) ; -- perform filter logic
89 N Y,Y0,SDNODE,SDSUB,SDZERO
90 S SDSUB=+$G(@SDQUERY@(SDQ,"IEN SUBSCRIPT"))
91 S SDZERO=$G(^TMP("SDQUERY CLASS",$J,SDQ,"ZERO"))
92 S Y=$QS(SDGREF,SDSUB)
93 IF SDZERO]"" D
94 . X SDZERO
95 ELSE D
96 . S SDNODE=$G(^TMP("SDQUERY CLASS",$J,SDQ,"GL"))_Y_",0)"
97 . S Y0=$G(@SDNODE)
98 X SDFIL
99 Q $T
100 ;
101 ;
102PRIOR(SDQ,SDERR) ; -- get prior global ref
103 ; API ID: 93
104 ; API NAME: SDQ PRIOR
105 ;
106PRIORG ; -- goto entry point
107 ; -- do validation checks
108 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G PRIORQ
109 IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G PRIORQ
110 IF $G(@SDQUERY@(SDQ,"BOF")) D BLD^SDQVAL(4096800.11,"","",$G(SDERR)) G PRIORQ
111 ;
112 N SDCUR,SDPRIOR
113 S SDCUR=+$G(@SDQUERY@(SDQ,"CURSOR"))
114 S SDPRIOR=$O(^TMP("SDQUERY LIST",$J,SDQ,SDCUR),-1)
115 ;
116 IF SDPRIOR D G PRIORQ
117 . S @SDQUERY@(SDQ,"CURSOR")=SDPRIOR
118 . S @SDQUERY@(SDQ,"BOF")=0
119 . S @SDQUERY@(SDQ,"EOF")=0
120 ELSE D
121 . S @SDQUERY@(SDQ,"BOF")=1
122PRIORQ Q
123 ;
124 ;
125FIRST(SDQ,SDERR) ; -- get first entry
126 ; API ID: 90
127 ; API NAME: SDQ FIRST
128 ;
129FIRSTG ; -- goto entry point
130 ; -- do validation checks
131 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G FIRSTQ
132 IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G FIRSTQ
133 ;
134 S @SDQUERY@(SDQ,"CURSOR")=+$O(^TMP("SDQUERY LIST",$J,SDQ,0),1)
135 S @SDQUERY@(SDQ,"BOF")=1
136 S @SDQUERY@(SDQ,"EOF")=(@SDQUERY@(SDQ,"CURSOR")=0)
137FIRSTQ Q
138 ;
139 ;
140LAST(SDQ,SDERR) ; -- get last entry
141 ; API ID: 91
142 ; API NAME: SDQ LAST
143 ;
144LASTG ; -- goto entry point
145 ; -- do validation checks
146 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G LASTQ
147 IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) G LASTQ
148 ;
149 IF $G(@SDQUERY@(SDQ,"MORE")) D GETREST(.SDQ,$G(SDERR))
150 S @SDQUERY@(SDQ,"CURSOR")=+$O(^TMP("SDQUERY LIST",$J,SDQ,""),-1)
151 S @SDQUERY@(SDQ,"BOF")=(@SDQUERY@(SDQ,"CURSOR")=0)
152 S @SDQUERY@(SDQ,"EOF")=1
153LASTQ Q
154 ;
155 ;
156EOF(SDQ,SDERR) ; -- at end of file
157 ; API ID: 86
158 ; API NAME: SDQ EOF
159 ;
160 ; -- do validation checks
161 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) Q 0
162 IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) Q 0
163 ;
164EOFQ Q $G(@SDQUERY@(SDQ,"EOF"))
165 ;
166 ;
167BOF(SDQ,SDERR) ; -- at beginning of file
168 ; API ID: 87
169 ; API NAME: SDQ BOF
170 ;
171 ; -- do validation checks
172 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) Q 0
173 IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) Q 0
174 ;
175BOFQ Q $G(@SDQUERY@(SDQ,"BOF"))
176 ;
177 ;
178COUNT(SDQ,SDERR) ; -- get entries count
179 ; API ID: 89
180 ; API NAME: SDQ COUNT
181 ;
182 ; -- do validation checks
183 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) Q ""
184 IF '$$QRYACT^SDQVAL(.SDQ,$G(SDERR)) Q ""
185 ;
186 IF $G(@SDQUERY@(SDQ,"MORE")) D GETREST(.SDQ,$G(SDERR))
187 Q +$G(@SDQUERY@(SDQ,"COUNT"))
188 ;
189 ;
190GETREST(SDQ,SDERR) ; -- get rest of entries
191 ;
192 F Q:'$G(@SDQUERY@(SDQ,"MORE")) D NEXT(.SDQ,$G(SDERR))
193 Q
194 ;
Note: See TracBrowser for help on using the repository browser.