MAGNPARM ;WOIFO/NST - Utilities for RPC calls ; 10 Aug 2017 4:16 PM
;;3.0;IMAGING;**185**;Mar 19, 2002;Build 92;Aug 02, 2012
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
;
;***** Changes value for named parameter
;
; RPC: MAGN PARAM SET LIST
;
; Input Parameters
; ================
;
; [MAGPARAM("PARAM")] - default "MAG USER PREF"
; [MAGPARAM("ENTITY")] - default "USR.`DUZ"
; [MAGPARAM("USER")] - default DUZ
; MAGPARAM("INSTANCEnnn")
; MAGPARAM("VALUEnnn")
;
; Return Values
; =============
; if error MAGRY = Failure status ^ Error message^
; if success MAGRY = Success status
;
SPARLIST(MAGRY,MAGPARAM) ; RPC [MAGN PARAM SET LIST]
N PARAM,VALUE,ENT,INST,ERR,USR,II,JJ
;
K MAGRY
S ERR=0
S PARAM=$G(MAGPARAM("PARAM"),"MAG USER PREF")
S USR=$G(MAGPARAM("USER"),DUZ)
S ENT=$G(MAGPARAM("ENTITY"),"USR.`"_USR)
S II="INSTANCE"
F S II=$O(MAGPARAM(II)) Q:II'["INSTANCE" D Q:ERR
. S INST=MAGPARAM(II)
. Q:INST=""
. D EN^XPAR(ENT,PARAM,INST,"@",.ERR) ; clean up first
. S JJ="VALUE"_$P(II,"INSTANCE",2)
. S VALUE=$G(MAGPARAM(JJ))
. I VALUE="@" Q ; we already deleted the value
. F S JJ=$O(MAGPARAM(JJ)) Q:JJ="" D
. . S VALUE(+$P(JJ,"_",2),0)=MAGPARAM(JJ) ; Add word-processing text if any
. . Q
. D EN^XPAR(ENT,PARAM,INST,.VALUE,.ERR)
. Q
I ERR=0 S MAGRY=$$SETOKVAL^MAGNU002("")
E S MAGRY=$$SETERROR^MAGNU002($P(ERR,"^",2))
Q
;
;***** Get a parameter list values
;
; RPC: MAGN PARAM GET LIST
;
; Input Parameters
; ================
;
; [MAGPARAM("PARAM")] - parameter name - default "MAG USER PREF"
; [MAGPARAM("FORMAT")] - I|Q|E|B - default "I" (internal)
; [MAGPARAM("ENTITY")] - Default "ALL"
;
; Return Values
; =============
; if error MAGRY(0) = Failure status ^ Error message^
; if success MAGRY(0) = Success status ^ ^counter
; MAGRY(1..n) = instance ^ value
;
GPARLIST(MAGRY,MAGPARAM) ; RPC [MAGN PARAM GET LIST]
N INST,CNT,ERR,TMP,PARAM,FMT,ENT
;
K MAGRY
S PARAM=$G(MAGPARAM("PARAM"),"MAG USER PREF")
S FMT=$G(MAGPARAM("FORMAT"),"I")
S ENT=$G(MAGPARAM("ENTITY"),"ALL")
D GETLST^XPAR(.TMP,ENT,PARAM,FMT,.ERR)
;
I $G(ERR) S @MAGRY@(0)=$$SETERROR^MAGNU002($P(ERR,"^",2)) Q
;
S CNT=0
S INST=""
F S INST=$O(TMP(INST)) Q:INST="" D
. S CNT=CNT+1,MAGRY(CNT)=INST_"^"_TMP(INST)
. Q
S MAGRY(0)=$$SETOKVAL^MAGNU002(CNT)
Q
;
;***** Get a value of an instance
;
; RPC: MAGN PARAM GET VALUE
;
; Input Parameters
; ================
;
; [MAGPARAM("PARAM")] - parameter name - default "MAG USER PREF"
; [MAGPARAM("ENTITY")] - Default "ALL"
; MAGPARAM("INSTANCE")
;
; Return Values
; =============
; if error MAGRY(0) = Failure status ^ Error message^
; if success MAGRY(0) = Success status ^ ^ value
; MAGRY(1..n) = value line 1..n
GET1(MAGRY,MAGPARAM) ; RPC [MAGN PARAM GET VALUE]
N I,OUT,PARAM,ENT,INST,ERR
;
K MAGRY
S PARAM=$G(MAGPARAM("PARAM"),"MAG USER PREF")
S ENT=$G(MAGPARAM("ENTITY"),"ALL")
S INST=$G(MAGPARAM("INSTANCE"),"")
I INST="" S MAGRY(0)=$$SETERROR^MAGNU002("The Instance value is missing") Q
D GETWP^XPAR(.OUT,ENT,PARAM,INST,.ERR)
I $G(ERR) S MAGRY(0)=$$SETERROR^MAGNU002($G(ERR)) Q
I '$D(OUT) S MAGRY(0)=$$SETERROR^MAGNU002("Instance not found") Q
S MAGRY(0)=$$SETOKVAL^MAGNU002($G(OUT))
S I=""
F S I=$O(OUT(I)) Q:'I D
. S MAGRY(I)=$G(OUT(I,0))
. Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGNPARM 4426 printed Dec 13, 2024@02:07:18 Page 2
MAGNPARM ;WOIFO/NST - Utilities for RPC calls ; 10 Aug 2017 4:16 PM
+1 ;;3.0;IMAGING;**185**;Mar 19, 2002;Build 92;Aug 02, 2012
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
+18 ;
+19 ;***** Changes value for named parameter
+20 ;
+21 ; RPC: MAGN PARAM SET LIST
+22 ;
+23 ; Input Parameters
+24 ; ================
+25 ;
+26 ; [MAGPARAM("PARAM")] - default "MAG USER PREF"
+27 ; [MAGPARAM("ENTITY")] - default "USR.`DUZ"
+28 ; [MAGPARAM("USER")] - default DUZ
+29 ; MAGPARAM("INSTANCEnnn")
+30 ; MAGPARAM("VALUEnnn")
+31 ;
+32 ; Return Values
+33 ; =============
+34 ; if error MAGRY = Failure status ^ Error message^
+35 ; if success MAGRY = Success status
+36 ;
SPARLIST(MAGRY,MAGPARAM) ; RPC [MAGN PARAM SET LIST]
+1 NEW PARAM,VALUE,ENT,INST,ERR,USR,II,JJ
+2 ;
+3 KILL MAGRY
+4 SET ERR=0
+5 SET PARAM=$GET(MAGPARAM("PARAM"),"MAG USER PREF")
+6 SET USR=$GET(MAGPARAM("USER"),DUZ)
+7 SET ENT=$GET(MAGPARAM("ENTITY"),"USR.`"_USR)
+8 SET II="INSTANCE"
+9 FOR
SET II=$ORDER(MAGPARAM(II))
if II'["INSTANCE"
QUIT
Begin DoDot:1
+10 SET INST=MAGPARAM(II)
+11 if INST=""
QUIT
+12 ; clean up first
DO EN^XPAR(ENT,PARAM,INST,"@",.ERR)
+13 SET JJ="VALUE"_$PIECE(II,"INSTANCE",2)
+14 SET VALUE=$GET(MAGPARAM(JJ))
+15 ; we already deleted the value
IF VALUE="@"
QUIT
+16 FOR
SET JJ=$ORDER(MAGPARAM(JJ))
if JJ=""
QUIT
Begin DoDot:2
+17 ; Add word-processing text if any
SET VALUE(+$PIECE(JJ,"_",2),0)=MAGPARAM(JJ)
+18 QUIT
End DoDot:2
+19 DO EN^XPAR(ENT,PARAM,INST,.VALUE,.ERR)
+20 QUIT
End DoDot:1
if ERR
QUIT
+21 IF ERR=0
SET MAGRY=$$SETOKVAL^MAGNU002("")
+22 IF '$TEST
SET MAGRY=$$SETERROR^MAGNU002($PIECE(ERR,"^",2))
+23 QUIT
+24 ;
+25 ;***** Get a parameter list values
+26 ;
+27 ; RPC: MAGN PARAM GET LIST
+28 ;
+29 ; Input Parameters
+30 ; ================
+31 ;
+32 ; [MAGPARAM("PARAM")] - parameter name - default "MAG USER PREF"
+33 ; [MAGPARAM("FORMAT")] - I|Q|E|B - default "I" (internal)
+34 ; [MAGPARAM("ENTITY")] - Default "ALL"
+35 ;
+36 ; Return Values
+37 ; =============
+38 ; if error MAGRY(0) = Failure status ^ Error message^
+39 ; if success MAGRY(0) = Success status ^ ^counter
+40 ; MAGRY(1..n) = instance ^ value
+41 ;
GPARLIST(MAGRY,MAGPARAM) ; RPC [MAGN PARAM GET LIST]
+1 NEW INST,CNT,ERR,TMP,PARAM,FMT,ENT
+2 ;
+3 KILL MAGRY
+4 SET PARAM=$GET(MAGPARAM("PARAM"),"MAG USER PREF")
+5 SET FMT=$GET(MAGPARAM("FORMAT"),"I")
+6 SET ENT=$GET(MAGPARAM("ENTITY"),"ALL")
+7 DO GETLST^XPAR(.TMP,ENT,PARAM,FMT,.ERR)
+8 ;
+9 IF $GET(ERR)
SET @MAGRY@(0)=$$SETERROR^MAGNU002($PIECE(ERR,"^",2))
QUIT
+10 ;
+11 SET CNT=0
+12 SET INST=""
+13 FOR
SET INST=$ORDER(TMP(INST))
if INST=""
QUIT
Begin DoDot:1
+14 SET CNT=CNT+1
SET MAGRY(CNT)=INST_"^"_TMP(INST)
+15 QUIT
End DoDot:1
+16 SET MAGRY(0)=$$SETOKVAL^MAGNU002(CNT)
+17 QUIT
+18 ;
+19 ;***** Get a value of an instance
+20 ;
+21 ; RPC: MAGN PARAM GET VALUE
+22 ;
+23 ; Input Parameters
+24 ; ================
+25 ;
+26 ; [MAGPARAM("PARAM")] - parameter name - default "MAG USER PREF"
+27 ; [MAGPARAM("ENTITY")] - Default "ALL"
+28 ; MAGPARAM("INSTANCE")
+29 ;
+30 ; Return Values
+31 ; =============
+32 ; if error MAGRY(0) = Failure status ^ Error message^
+33 ; if success MAGRY(0) = Success status ^ ^ value
+34 ; MAGRY(1..n) = value line 1..n
GET1(MAGRY,MAGPARAM) ; RPC [MAGN PARAM GET VALUE]
+1 NEW I,OUT,PARAM,ENT,INST,ERR
+2 ;
+3 KILL MAGRY
+4 SET PARAM=$GET(MAGPARAM("PARAM"),"MAG USER PREF")
+5 SET ENT=$GET(MAGPARAM("ENTITY"),"ALL")
+6 SET INST=$GET(MAGPARAM("INSTANCE"),"")
+7 IF INST=""
SET MAGRY(0)=$$SETERROR^MAGNU002("The Instance value is missing")
QUIT
+8 DO GETWP^XPAR(.OUT,ENT,PARAM,INST,.ERR)
+9 IF $GET(ERR)
SET MAGRY(0)=$$SETERROR^MAGNU002($GET(ERR))
QUIT
+10 IF '$DATA(OUT)
SET MAGRY(0)=$$SETERROR^MAGNU002("Instance not found")
QUIT
+11 SET MAGRY(0)=$$SETOKVAL^MAGNU002($GET(OUT))
+12 SET I=""
+13 FOR
SET I=$ORDER(OUT(I))
if 'I
QUIT
Begin DoDot:1
+14 SET MAGRY(I)=$GET(OUT(I,0))
+15 QUIT
End DoDot:1
+16 QUIT