Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MAGNPARM

MAGNPARM.m

Go to the documentation of this file.
  1. 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
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. Q
  1. ;
  1. ;***** Changes value for named parameter
  1. ;
  1. ; RPC: MAGN PARAM SET LIST
  1. ;
  1. ; Input Parameters
  1. ; ================
  1. ;
  1. ; [MAGPARAM("PARAM")] - default "MAG USER PREF"
  1. ; [MAGPARAM("ENTITY")] - default "USR.`DUZ"
  1. ; [MAGPARAM("USER")] - default DUZ
  1. ; MAGPARAM("INSTANCEnnn")
  1. ; MAGPARAM("VALUEnnn")
  1. ;
  1. ; Return Values
  1. ; =============
  1. ; if error MAGRY = Failure status ^ Error message^
  1. ; if success MAGRY = Success status
  1. ;
  1. SPARLIST(MAGRY,MAGPARAM) ; RPC [MAGN PARAM SET LIST]
  1. N PARAM,VALUE,ENT,INST,ERR,USR,II,JJ
  1. ;
  1. K MAGRY
  1. S ERR=0
  1. S PARAM=$G(MAGPARAM("PARAM"),"MAG USER PREF")
  1. S USR=$G(MAGPARAM("USER"),DUZ)
  1. S ENT=$G(MAGPARAM("ENTITY"),"USR.`"_USR)
  1. S II="INSTANCE"
  1. F S II=$O(MAGPARAM(II)) Q:II'["INSTANCE" D Q:ERR
  1. . S INST=MAGPARAM(II)
  1. . Q:INST=""
  1. . D EN^XPAR(ENT,PARAM,INST,"@",.ERR) ; clean up first
  1. . S JJ="VALUE"_$P(II,"INSTANCE",2)
  1. . S VALUE=$G(MAGPARAM(JJ))
  1. . I VALUE="@" Q ; we already deleted the value
  1. . F S JJ=$O(MAGPARAM(JJ)) Q:JJ="" D
  1. . . S VALUE(+$P(JJ,"_",2),0)=MAGPARAM(JJ) ; Add word-processing text if any
  1. . . Q
  1. . D EN^XPAR(ENT,PARAM,INST,.VALUE,.ERR)
  1. . Q
  1. I ERR=0 S MAGRY=$$SETOKVAL^MAGNU002("")
  1. E S MAGRY=$$SETERROR^MAGNU002($P(ERR,"^",2))
  1. Q
  1. ;
  1. ;***** Get a parameter list values
  1. ;
  1. ; RPC: MAGN PARAM GET LIST
  1. ;
  1. ; Input Parameters
  1. ; ================
  1. ;
  1. ; [MAGPARAM("PARAM")] - parameter name - default "MAG USER PREF"
  1. ; [MAGPARAM("FORMAT")] - I|Q|E|B - default "I" (internal)
  1. ; [MAGPARAM("ENTITY")] - Default "ALL"
  1. ;
  1. ; Return Values
  1. ; =============
  1. ; if error MAGRY(0) = Failure status ^ Error message^
  1. ; if success MAGRY(0) = Success status ^ ^counter
  1. ; MAGRY(1..n) = instance ^ value
  1. ;
  1. GPARLIST(MAGRY,MAGPARAM) ; RPC [MAGN PARAM GET LIST]
  1. N INST,CNT,ERR,TMP,PARAM,FMT,ENT
  1. ;
  1. K MAGRY
  1. S PARAM=$G(MAGPARAM("PARAM"),"MAG USER PREF")
  1. S FMT=$G(MAGPARAM("FORMAT"),"I")
  1. S ENT=$G(MAGPARAM("ENTITY"),"ALL")
  1. D GETLST^XPAR(.TMP,ENT,PARAM,FMT,.ERR)
  1. ;
  1. I $G(ERR) S @MAGRY@(0)=$$SETERROR^MAGNU002($P(ERR,"^",2)) Q
  1. ;
  1. S CNT=0
  1. S INST=""
  1. F S INST=$O(TMP(INST)) Q:INST="" D
  1. . S CNT=CNT+1,MAGRY(CNT)=INST_"^"_TMP(INST)
  1. . Q
  1. S MAGRY(0)=$$SETOKVAL^MAGNU002(CNT)
  1. Q
  1. ;
  1. ;***** Get a value of an instance
  1. ;
  1. ; RPC: MAGN PARAM GET VALUE
  1. ;
  1. ; Input Parameters
  1. ; ================
  1. ;
  1. ; [MAGPARAM("PARAM")] - parameter name - default "MAG USER PREF"
  1. ; [MAGPARAM("ENTITY")] - Default "ALL"
  1. ; MAGPARAM("INSTANCE")
  1. ;
  1. ; Return Values
  1. ; =============
  1. ; if error MAGRY(0) = Failure status ^ Error message^
  1. ; if success MAGRY(0) = Success status ^ ^ value
  1. ; MAGRY(1..n) = value line 1..n
  1. GET1(MAGRY,MAGPARAM) ; RPC [MAGN PARAM GET VALUE]
  1. N I,OUT,PARAM,ENT,INST,ERR
  1. ;
  1. K MAGRY
  1. S PARAM=$G(MAGPARAM("PARAM"),"MAG USER PREF")
  1. S ENT=$G(MAGPARAM("ENTITY"),"ALL")
  1. S INST=$G(MAGPARAM("INSTANCE"),"")
  1. I INST="" S MAGRY(0)=$$SETERROR^MAGNU002("The Instance value is missing") Q
  1. D GETWP^XPAR(.OUT,ENT,PARAM,INST,.ERR)
  1. I $G(ERR) S MAGRY(0)=$$SETERROR^MAGNU002($G(ERR)) Q
  1. I '$D(OUT) S MAGRY(0)=$$SETERROR^MAGNU002("Instance not found") Q
  1. S MAGRY(0)=$$SETOKVAL^MAGNU002($G(OUT))
  1. S I=""
  1. F S I=$O(OUT(I)) Q:'I D
  1. . S MAGRY(I)=$G(OUT(I,0))
  1. . Q
  1. Q