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

RORRP038.m

Go to the documentation of this file.
  1. RORRP038 ;HCIOFO/SG - RPC: USER AND PACKAGE PARAMETERS ; 11/21/05 9:28am
  1. ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
  1. ;
  1. ; This routine uses the following IA's:
  1. ;
  1. ; #2263 GETWP^XPAR and PUT^XPAR (supported)
  1. ;
  1. Q
  1. ;
  1. ;***** RETRIEVES THE VALUE OF THE GUI PARAMETER
  1. ; RPC: [ROR GUI PARAMETER GET]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; INSTANCE Instance name of the GUI parameter.
  1. ; Optional second "^"-piece of this parameter can
  1. ; contain name of the parameter. By default, the
  1. ; "ROR GUI PARAMETER" is used.
  1. ;
  1. ; [ENTITY] Entity where the parameter value is searched for.
  1. ; By default ($G(ENTITY)=""), the "ALL" value is used
  1. ; (see the DBIA #2263 for more details).
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0) indicates
  1. ; an error (see the RPCSTK^RORERR procedure for more details).
  1. ;
  1. ; Otherwise, the RESULTS(0) will contain 0 and the subsequent nodes
  1. ; of the RESULTS array will contain the lines of parameter value.
  1. ;
  1. GETPARM(RESULTS,INSTANCE,ENTITY) ;
  1. N CNT,I,RC,RORBUF,RORERRDL,RORMSG K RESULTS
  1. D CLEAR^RORERR("GETPARM^RORRP038",1)
  1. ;--- Check the parameters
  1. I $G(INSTANCE)="" D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-88,,,,"INSTANCE",$G(INSTANCE))
  1. S:$G(ENTITY)="" ENTITY="ALL"
  1. S NAME=$P(INSTANCE,U,2)
  1. S:$G(NAME)="" NAME="ROR GUI PARAMETER"
  1. ;--- Get the value
  1. D GETWP^XPAR(.RORBUF,ENTITY,NAME,$P(INSTANCE,U),.RORMSG)
  1. I $G(RORMSG) D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-56,,$P(RORMSG,U,2),,+RORMSG,"GETWP^XPAR")
  1. S RESULTS(0)=0
  1. ;--- Ignore and delete old parameters without description.
  1. ; These parameters were created by the CCR v1.0.
  1. ;--- Unfortunately, the ENVAL^XPAR procedure ignores them.
  1. I $G(RORBUF)="" D DEL^XPAR(ENTITY,NAME,$P(INSTANCE,U)) Q
  1. ;--- Copy the value to the output array
  1. S I="",CNT=0
  1. F S I=$O(RORBUF(I)) Q:I="" D
  1. . S CNT=CNT+1,RESULTS(CNT)=RORBUF(I,0) K RORBUF(I)
  1. Q
  1. ;
  1. ;***** RETRIEVES THE LIST OF ALL INSTANCES OF THE PARAMETER
  1. ; RPC: [ROR LIST PARAMETER INSTANCES]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; [NAME] Name of the parameter (by default, the
  1. ; "ROR GUI PARAMETER" is used)
  1. ;
  1. ; [ENTITY] Entity where the parameters are searched for.
  1. ; By default ($G(ENTITY)=""), the "ALL" value is used
  1. ; (see the DBIA #2263 for more details).
  1. ;
  1. ; [PREFIX] Instance name prefix (by default, all instances
  1. ; are selected). Bear in mind that the prefix is
  1. ; removed from the instance names.
  1. ;
  1. GETPLIST(RESULTS,NAME,ENTITY,PREFIX) ;
  1. N CNT,I,LP,RC,RORBUF,RORERRDL,RORMSG K RESULTS
  1. D CLEAR^RORERR("GETRPLST^RORRP038",1)
  1. S:$G(NAME)="" NAME="ROR GUI PARAMETER"
  1. S:$G(ENTITY)="" ENTITY="ALL"
  1. S:$G(PREFIX)="" PREFIX=""
  1. D GETLST^XPAR(.RESULTS,ENTITY,NAME,"Q")
  1. I $G(RORMSG) D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-56,,$P(RORMSG,U,2),,+RORMSG,"GETLST^XPAR")
  1. ;--- Screen unwanted instances and strip the prefixes
  1. S LP=$L(PREFIX)
  1. I LP>0 S (CNT,I)=0 D
  1. . F S I=$O(RESULTS(I)) Q:I="" D
  1. . . I $E(RESULTS(I),1,LP)'=PREFIX K RESULTS(I) Q
  1. . . S RESULTS(I)=$E(RESULTS(I),LP+1,999),CNT=CNT+1
  1. E S CNT=+$G(RESULTS)
  1. ;--- Store the total number of instances
  1. S RESULTS(0)=CNT,RESULTS=""
  1. Q
  1. ;
  1. ;***** RENAMES THE INSTANCE OF THE GUI PARAMETER
  1. ; RPC: [ROR GUI PARAMETER RENAME]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; ENTITY Entity that the parameter is associated with.
  1. ;
  1. ; NAME Name of the parameter
  1. ;
  1. ; OLDINST Current instance name of the GUI parameter
  1. ;
  1. ; NEWINST New instance name for the GUI parameter
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0) indicates
  1. ; an error (see the RPCSTK^RORERR procedure for more details).
  1. ;
  1. ; Otherwise, the RESULTS(0) will contain 0.
  1. ;
  1. RENPARM(RESULTS,ENTITY,NAME,OLDINST,NEWINST) ;
  1. N RC,RORERRDL,RORMSG,TMP K RESULTS
  1. D CLEAR^RORERR("RENPARM^RORRP038",1)
  1. ;--- Check the parameters
  1. I $G(ENTITY)="" D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-88,,,,"ENTITY",$G(ENTITY))
  1. I $G(NAME)="" D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-88,,,,"NAME",$G(NAME))
  1. I $G(OLDINST)="" D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-88,,,,"OLDINST",$G(OLDINST))
  1. I $G(NEWINST)="" D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-88,,,,"NEWINST",$G(NEWINST))
  1. ;--- Delete the instance with the new name if it exists
  1. ;--- (otherwise, the REP^XPAR will return an error)
  1. D:$$UP^XLFSTR(OLDINST)'=$$UP^XLFSTR(NEWINST)
  1. . D DEL^XPAR(ENTITY,NAME,NEWINST,.RORMSG) K RORMSG
  1. ;--- Rename the instance
  1. D REP^XPAR(ENTITY,NAME,OLDINST,NEWINST,.RORMSG)
  1. I $G(RORMSG) D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-56,,$P(RORMSG,U,2),,+RORMSG,"REP^XPAR")
  1. S RESULTS(0)=0
  1. Q
  1. ;
  1. ;***** STORES THE VALUE OF THE GUI PARAMETER
  1. ; RPC: [ROR GUI PARAMETER SET]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; INSTANCE Instance name of the GUI parameter.
  1. ; Optional second "^"-piece of this parameter can
  1. ; contain name of the parameter. By default, the
  1. ; "ROR GUI PARAMETER" is used.
  1. ;
  1. ; [ENTITY] Entity that the parameter is associated with.
  1. ; By default ($G(ENTITY)=""), the "USR" value is used
  1. ; (see the DBIA #2263 for more details).
  1. ;
  1. ; [.]VALUE Value of the parameter. It should be either a string
  1. ; or a reference to a local array that contains a text
  1. ; (prepared for a word-processing field).
  1. ;
  1. ; The local array should not contain the 0 subscript
  1. ; (it will not be stored).
  1. ;
  1. ; You can use the "@" value to delete the parameter.
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0) indicates
  1. ; an error (see the RPCSTK^RORERR procedure for more details).
  1. ;
  1. ; Otherwise, the RESULTS(0) will contain 0.
  1. ;
  1. SETPARM(RESULTS,INSTANCE,ENTITY,VALUE) ;
  1. N RC,RORBUF,RORERRDL,RORMSG,TMP K RESULTS
  1. D CLEAR^RORERR("SETPARM^RORRP038",1)
  1. ;--- Check the parameters
  1. I $G(INSTANCE)="" D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-88,,,,"INSTANCE",$G(INSTANCE))
  1. I '$D(VALUE) D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-88,,,,"VALUE","<UNDEFINED>")
  1. S:$G(ENTITY)="" ENTITY="USR"
  1. S NAME=$P(INSTANCE,U,2)
  1. S:$G(NAME)="" NAME="ROR GUI PARAMETER"
  1. ;--- Prepare the value (make sure the description is not empty)
  1. I $D(VALUE),$G(VALUE)'="@" D
  1. . I $D(VALUE)=1 S RORBUF(1,0)=VALUE
  1. . E M RORBUF=VALUE
  1. . S:$G(RORBUF)="" RORBUF="CCR GUI Parameter"
  1. E S RORBUF="@"
  1. ;--- Store the value
  1. D PUT^XPAR(ENTITY,NAME,$P(INSTANCE,U),.RORBUF,.RORMSG)
  1. I $G(RORMSG),+RORMSG'=1 D D RPCSTK^RORERR(.RESULTS,RC) Q
  1. . S RC=$$ERROR^RORERR(-56,,$P(RORMSG,U,2),,+RORMSG,"PUT^XPAR")
  1. S RESULTS=0
  1. Q