source: WorldVistAEHR/trunk/r/WORLDVISTA-VW/VWUTIL.m@ 1006

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

revised back to 6/30/08 version

File size: 1.8 KB
Line 
1VWUTIL ;WVEHR/Maury Pepper/Skip Ormsby- World VistA Utilities;7:32 PM 30 Jan 2008
2 ;;WVEHR-1007;WORLD VISTA;*WVEHR1*;;WorldVistA 30-Jan-08
3 ;
4 ;Modified from FOIA VISTA,
5 ;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
6 ;General Public License See attached copy of the License.
7 ;
8 ;This program is free software; you can redistribute it and/or modify
9 ;it under the terms of the GNU General Public License as published by
10 ;the Free Software Foundation; either version 2 of the License, or
11 ;(at your option) any later version.
12 ;
13 ;This program is distributed in the hope that it will be useful,
14 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;GNU General Public License for more details.
17 ;
18 ;You should have received a copy of the GNU General Public License along
19 ;with this program; if not, write to the Free Software Foundation, Inc.,
20 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 ;
22 Q
23 ;
24Q(V,D) ; Function to return $QUERY for variable V and direction D.
25 ; Replacement for Reverse $Q Function
26 ; 1/8/08 MLP
27 ;This function can be called for $Query -- either forward or reverse.
28 ;In place of $Q(V,D), use $$Q^ZDQ($NA(V),D)
29 ;Note: the 2nd argument is optional.
30 ;
31 S D=+$G(D,1)
32 Q:D=1 $Q(@V) ;Forward $Q
33 IF D'=-1 Q ;Will cause error due to no argument.
34 N S
35TOP IF $QL(V)=0 Q "" ;done if unsubscripted
36BKU S S=$O(@V,-1) ;backup to previous node on current level
37 S V=$NA(@V,$QL(V)-1) ;remove last subscript
38 IF S="" G DAT ;go chk for data if backed up all the way
39 S V=$NA(@V@(S)) ;add the subscript found when backing up.
40 IF $D(@V)>9 S V=$NA(@V@("")) G BKU ;if downpointer, descend and repeat
41DAT IF $D(@V)#2=1 Q V ;if a data node, return with current name
42 G TOP
Note: See TracBrowser for help on using the repository browser.