ISINUQRY ; ISI/NST - $Q function ; 10/17/2022
;;1.1;ESL ISI IMAGING;**99,110**;Dec 21, 2022;Build 41
;; This routine is the property of ViTel Net, and should not be modified.
;; This software is a medical device and is subject to FDA regulation.
;; Modifications to this software may only be made under the terms of
;; 21CFR820 regulation. 21CFR Subpart A 820.1: "The failure to comply
;; with any applicable provision in this part renders a device
;; adulterated under section 501(h) of the act. Such a device,
;; as well as any person responsible for the failure to comply,
;; is subject to regulatory action."
Q
;
Q(V,D) ; Function to return $QUERY for variable V and direction D.
; Replacement for Reverse $Q Function
; 1/8/08 MLP
;This function can be called for $Query -- either forward or reverse.
;In place of $Q(V,D), use $$Q^ZDQ($NA(V),D)
;Note: the 2nd argument is optional.
;
S D=+$G(D,1)
Q:D=1 $Q(@V) ;Forward $Q
IF D'=-1 Q ;Will cause error due to no argument.
N S
TOP IF $QL(V)=0 Q "" ;done if unsubscripted
BKU S S=$O(@V,-1) ;backup to previous node on current level
S V=$NA(@V,$QL(V)-1) ;remove last subscript
IF S="" G DAT ;go chk for data if backed up all the way
S V=$NA(@V@(S)) ;add the subscript found when backing up.
IF $D(@V)>9 S V=$NA(@V@("")) G BKU ;if downpointer, descend and repeat
DAT IF $D(@V)#2=1 Q V ;if a data node, return with current name
G TOP
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HISINUQRY 1489 printed Nov 22, 2024@17:54:10 Page 2
ISINUQRY ; ISI/NST - $Q function ; 10/17/2022
+1 ;;1.1;ESL ISI IMAGING;**99,110**;Dec 21, 2022;Build 41
+2 ;; This routine is the property of ViTel Net, and should not be modified.
+3 ;; This software is a medical device and is subject to FDA regulation.
+4 ;; Modifications to this software may only be made under the terms of
+5 ;; 21CFR820 regulation. 21CFR Subpart A 820.1: "The failure to comply
+6 ;; with any applicable provision in this part renders a device
+7 ;; adulterated under section 501(h) of the act. Such a device,
+8 ;; as well as any person responsible for the failure to comply,
+9 ;; is subject to regulatory action."
+10 QUIT
+11 ;
Q(V,D) ; Function to return $QUERY for variable V and direction D.
+1 ; Replacement for Reverse $Q Function
+2 ; 1/8/08 MLP
+3 ;This function can be called for $Query -- either forward or reverse.
+4 ;In place of $Q(V,D), use $$Q^ZDQ($NA(V),D)
+5 ;Note: the 2nd argument is optional.
+6 ;
+7 SET D=+$GET(D,1)
+8 ;Forward $Q
if D=1
QUIT $QUERY(@V)
+9 ;Will cause error due to no argument.
IF D'=-1
QUIT
+10 NEW S
TOP ;done if unsubscripted
IF $QLENGTH(V)=0
QUIT ""
BKU ;backup to previous node on current level
SET S=$ORDER(@V,-1)
+1 ;remove last subscript
SET V=$NAME(@V,$QLENGTH(V)-1)
+2 ;go chk for data if backed up all the way
IF S=""
GOTO DAT
+3 ;add the subscript found when backing up.
SET V=$NAME(@V@(S))
+4 ;if downpointer, descend and repeat
IF $DATA(@V)>9
SET V=$NAME(@V@(""))
GOTO BKU
DAT ;if a data node, return with current name
IF $DATA(@V)#2=1
QUIT V
+1 GOTO TOP
+2 ;